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