From 5765893f690b585fadae1ed3de3b18356ee2822f Mon Sep 17 00:00:00 2001 From: Christopher Timm Date: Mon, 26 Apr 2021 19:06:30 -0500 Subject: [PATCH] Use gosu instead of sudo for easier configuration #879 --- Dockerfile | 6 +++--- docker/docker-entrypoint.sh | 4 ++-- docker/management_script.sh | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 324983a0b..1527ebde8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,7 @@ RUN apt-get update \ imagemagick \ gettext \ tzdata \ - sudo \ + gosu \ # fonts for text file thumbnail generation fonts-liberation \ # for Numpy @@ -96,8 +96,8 @@ COPY src/ ./ RUN addgroup --gid 1000 paperless \ && useradd --uid 1000 --gid paperless --home-dir /usr/src/paperless paperless \ && chown -R paperless:paperless ../ \ - && sudo -HEu paperless python3 manage.py collectstatic --clear --no-input \ - && sudo -HEu paperless python3 manage.py compilemessages + && gosu paperless python3 manage.py collectstatic --clear --no-input \ + && gosu paperless python3 manage.py compilemessages VOLUME ["/usr/src/paperless/data", "/usr/src/paperless/media", "/usr/src/paperless/consume", "/usr/src/paperless/export"] ENTRYPOINT ["/sbin/docker-entrypoint.sh"] diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index e9cfd2b7e..26df5f31a 100755 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -34,7 +34,7 @@ initialize() { chown -R paperless:paperless /tmp/paperless set -e - sudo -HEu paperless /sbin/docker-prepare.sh + gosu paperless /sbin/docker-prepare.sh } install_languages() { @@ -85,7 +85,7 @@ initialize if [[ "$1" != "/"* ]]; then echo Executing management command "$@" - exec sudo -HEu paperless python3 manage.py "$@" + exec gosu paperless python3 manage.py "$@" else echo Executing "$@" exec "$@" diff --git a/docker/management_script.sh b/docker/management_script.sh index bffa26e98..a0d38f2bc 100755 --- a/docker/management_script.sh +++ b/docker/management_script.sh @@ -6,7 +6,7 @@ cd /usr/src/paperless/src/ if [[ $(id -u) == 0 ]] ; then - sudo -HEu paperless python3 manage.py management_command "$@" + gosu paperless python3 manage.py management_command "$@" elif [[ $(id -un) == "paperless" ]] ; then python3 manage.py management_command "$@"