From eb33655c1c2744aeb1a85242d44f08b7019f9871 Mon Sep 17 00:00:00 2001 From: kolaente Date: Wed, 15 Feb 2023 10:39:48 +0100 Subject: [PATCH] fix(docker): make sure the vikunja user always exists and only modify the uid instead of recreating the user Resolves #1392 --- Dockerfile | 4 +++- docker/entrypoint.sh | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 38e129b26..39f0b3cdd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,7 +33,9 @@ ENV VIKUNJA_SERVICE_ROOTPATH=/app/vikunja/ ENV PUID 1000 ENV PGID 1000 -RUN apk --update --no-cache add tzdata tini +RUN apk --update --no-cache add tzdata tini shadow && \ + addgroup vikunja && \ + adduser -s /bin/sh -D -G vikunja vikunja -h /app/vikunja -H COPY docker/entrypoint.sh /entrypoint.sh RUN chmod 0755 /entrypoint.sh && mkdir files diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 3a5adf812..d5eeb4f86 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -4,8 +4,8 @@ set -e if [ -n "$PUID" ] && [ "$PUID" -ne 0 ] && \ [ -n "$PGID" ] && [ "$PGID" -ne 0 ] ; then echo "info: creating the new user vikunja with $PUID:$PGID" - addgroup -g "$PGID" vikunja - adduser -s /bin/sh -D -G vikunja -u "$PUID" vikunja -h /app/vikunja -H + groupmod -g "$PGID" vikunja + usermod -u "$PUID" vikunja chown -R vikunja:vikunja ./ exec su vikunja -c /app/vikunja/vikunja "$@" else