From fa37d5bf59c3b704b25052ac404100c5fe28940a Mon Sep 17 00:00:00 2001 From: kolaente Date: Fri, 22 May 2020 18:11:20 +0200 Subject: [PATCH] Add changing the uid and gid in docker through env variables --- Dockerfile | 4 ++++ run.sh | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/Dockerfile b/Dockerfile index e49b63473..111aeb79d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,6 +26,10 @@ COPY run.sh /run.sh # copy compiled files from stage 1 COPY --from=compile-image /build/dist /usr/share/nginx/html +# Unprivileged user +ENV PUID 1000 +ENV PGID 1000 + LABEL maintainer="maintainers@vikunja.io" CMD "/run.sh" \ No newline at end of file diff --git a/run.sh b/run.sh index d917f12d0..58596264b 100755 --- a/run.sh +++ b/run.sh @@ -11,4 +11,8 @@ VIKUNJA_API_URL=$(echo $VIKUNJA_API_URL |sed 's/\//\\\//g') sed -i "s/http\:\/\/localhost\:3456\/api\/v1/$VIKUNJA_API_URL/g" /usr/share/nginx/html/index.html +# Set the uid and gid of the nginx run user +usermod --non-unique --uid ${PUID} nginx +groupmod --non-unique --gid ${PGID} nginx + nginx -g "daemon off;"