From 77b72709591f854de3648631bbc131e3b11eb134 Mon Sep 17 00:00:00 2001 From: Yuri Volchkov Date: Wed, 3 Aug 2022 19:08:36 +0000 Subject: [PATCH] add build argument to use different uid/gid While uid/gid 1000 will work in most setups, sometimes users have different uid/gid. For example is a shared machine with multiple users. Signed-off-by: Yuri Volchkov --- Dockerfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6d5208a4..c7b980c1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,6 +11,9 @@ RUN ./scripts/acceptance.sh # Choose alpine as a base image to make this useful for CI, as many # CI tools expect an interactive shell inside the container FROM alpine:3 as production +ARG USER_ID=1000 +ARG GROUP_ID=1000 + LABEL maintainer="Mike Farah " COPY --from=builder /go/src/mikefarah/yq/yq /usr/bin/yq @@ -18,8 +21,8 @@ COPY --from=builder /go/src/mikefarah/yq/yq /usr/bin/yq WORKDIR /workdir RUN set -eux; \ - addgroup -g 1000 yq; \ - adduser -u 1000 -G yq -s /bin/sh -h /home/yq -D yq + addgroup -g $GROUP_ID yq; \ + adduser -u $USER_ID -G yq -s /bin/sh -h /home/yq -D yq RUN chown -R yq:yq /workdir