Skip to content

Commit

Permalink
makefile: Add DOCKER_{UID,GID,TAG} make params (erigontech#4457)
Browse files Browse the repository at this point in the history
Co-authored-by: 3np <[email protected]>
  • Loading branch information
3nprob and 3np authored Jun 16, 2022
1 parent 2e60031 commit a738a0d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ FROM docker.io/library/alpine:3.15
RUN apk add --no-cache ca-certificates libstdc++ tzdata
COPY --from=builder /app/build/bin/* /usr/local/bin/

RUN adduser -H -u 1000 -g 1000 -D erigon
ARG PUID=1000
ARG PGID=1000
RUN adduser -H -u ${PUID} -g ${PGID} -D erigon
RUN mkdir -p /home/erigon
RUN mkdir -p /home/erigon/.local/share/erigon
RUN chown -R erigon:erigon /home/erigon
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ GOBIN = $(CURDIR)/build/bin
GIT_COMMIT ?= $(shell git rev-list -1 HEAD)
GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
GIT_TAG ?= $(shell git describe --tags '--match=v*' --dirty)
DOCKER_UID ?= 1000
DOCKER_PID ?= 1000
DOCKER_TAG ?= thorax/erigon:latest

CGO_CFLAGS := $(shell $(GO) env CGO_CFLAGS) # don't loose default
CGO_CFLAGS += -DMDBX_FORCE_ASSERTIONS=1 # Enable MDBX's asserts by default in 'devel' branch and disable in 'stable'
Expand All @@ -30,10 +33,12 @@ go-version:
fi

docker: git-submodules
DOCKER_BUILDKIT=1 docker build -t thorax/erigon:latest \
DOCKER_BUILDKIT=1 docker build -t ${DOCKER_TAG} \
--build-arg "BUILD_DATE=$(shell date -Iseconds)" \
--build-arg VCS_REF=${GIT_COMMIT} \
--build-arg VERSION=${GIT_TAG} \
--build-arg PUID=${DOCKER_UID} \
--build-arg PGID=${DOCKER_PID} \
${DOCKER_FLAGS} \
.

Expand Down

0 comments on commit a738a0d

Please sign in to comment.