From a738a0dd5102c3ded2d4c8087e0755eed1bfa8ca Mon Sep 17 00:00:00 2001 From: 3nprob <74199244+3nprob@users.noreply.github.com> Date: Thu, 16 Jun 2022 14:50:59 +0000 Subject: [PATCH] makefile: Add DOCKER_{UID,GID,TAG} make params (#4457) Co-authored-by: 3np <3np@example.com> --- Dockerfile | 4 +++- Makefile | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1f913496e97..cd79ce62baa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/Makefile b/Makefile index 51104b84947..7a0dd3d99d5 100644 --- a/Makefile +++ b/Makefile @@ -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' @@ -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} \ .