fix: re-enable change user and fix SIGTERM (#2882)

* re-enable change user

* fix gosu and close #2723
This commit is contained in:
Hayden 2024-01-11 17:03:08 -06:00 committed by GitHub
parent 9c0ce1af27
commit 58df50f624
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 10 deletions

View File

@ -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"]

View File

@ -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