From 58df50f624c19a79614b6389d9a34c26203bd01b Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Thu, 11 Jan 2024 17:03:08 -0600 Subject: [PATCH] fix: re-enable change user and fix SIGTERM (#2882) * re-enable change user * fix gosu and close #2723 --- docker/Dockerfile | 2 +- docker/entry.sh | 15 ++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 919d27b7d007..1e786291bd79 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -138,4 +138,4 @@ EXPOSE ${APP_PORT} COPY ./docker/entry.sh $MEALIE_HOME/run.sh RUN chmod +x $MEALIE_HOME/run.sh -ENTRYPOINT $MEALIE_HOME/run.sh +ENTRYPOINT ["/app/run.sh"] diff --git a/docker/entry.sh b/docker/entry.sh index 9bbddf1ecf3a..2754ddecfec4 100644 --- a/docker/entry.sh +++ b/docker/entry.sh @@ -1,13 +1,10 @@ -# Start Backend API #!/bin/bash - -# Strict Mode -# set -e -# IFS=$'\n\t' +# Start Backend API # Get PUID/PGID PUID=${PUID:-911} PGID=${PGID:-911} +BASH_SOURCE=${BASH_SOURCE:-$0} add_user() { groupmod -o -g "$PGID" abc @@ -22,7 +19,7 @@ change_user() { echo "Switching to dedicated user" exec gosu $PUID "$BASH_SOURCE" "$@" - elif [ "$(id -u)" = $PUID ]; then + elif [ "$(id -u)" = $PUID ]; then echo " User uid: $PUID User gid: $PGID @@ -41,7 +38,7 @@ init() { poetry run python /app/mealie/db/init_db.py } -# change_user +change_user init GUNICORN_PORT=${API_PORT:-9000} @@ -49,7 +46,7 @@ GUNICORN_PORT=${API_PORT:-9000} hostip=`/sbin/ip route|awk '/default/ { print $3 }'` if [ "$WEB_GUNICORN" = 'true' ]; then echo "Starting Gunicorn" - gunicorn mealie.app:app -b 0.0.0.0:$GUNICORN_PORT --forwarded-allow-ips=$hostip -k uvicorn.workers.UvicornWorker -c /app/gunicorn_conf.py --preload + exec gunicorn mealie.app:app -b 0.0.0.0:$GUNICORN_PORT --forwarded-allow-ips=$hostip -k uvicorn.workers.UvicornWorker -c /app/gunicorn_conf.py --preload else - uvicorn mealie.app:app --host 0.0.0.0 --forwarded-allow-ips=$hostip --port $GUNICORN_PORT + exec uvicorn mealie.app:app --host 0.0.0.0 --forwarded-allow-ips=$hostip --port $GUNICORN_PORT fi