chore: Update entrypoint.sh script for web UI Docker container

This commit is contained in:
Théophile Diot 2024-08-08 13:50:53 +01:00
parent c61f0d1784
commit 1669dab8ba
No known key found for this signature in database
GPG key ID: FA995104A0BA376A

View file

@ -4,6 +4,24 @@ set -e
# shellcheck disable=SC1091
. /usr/share/bunkerweb/helpers/utils.sh
# trap SIGTERM and SIGINT
function trap_exit() {
# shellcheck disable=SC2317
log "ENTRYPOINT" " " "Caught stop operation"
# shellcheck disable=SC2317
if [ -f "/var/run/bunkerweb/ui.pid" ] ; then
# shellcheck disable=SC2317
log "ENTRYPOINT" " " "Stopping web UI ..."
# shellcheck disable=SC2317
kill -s TERM "$(cat /var/run/bunkerweb/ui.pid)"
fi
}
trap "trap_exit" TERM INT QUIT
if [ -f /var/run/bunkerweb/ui.pid ] ; then
rm -f /var/run/bunkerweb/ui.pid
fi
log "ENTRYPOINT" "" "Starting the web UI v$(cat /usr/share/bunkerweb/VERSION) ..."
# setup and check /data folder
@ -19,7 +37,16 @@ else
echo "Docker" > /usr/share/bunkerweb/INTEGRATION
fi
python3 -m gunicorn --config gunicorn.conf.py --user ui --group ui --bind 0.0.0.0:7000
python3 -m gunicorn --config gunicorn.conf.py --user ui --group ui --bind 0.0.0.0:7000 &
pid="$!"
wait "$pid"
while [ -f /var/run/bunkerweb/ui.pid ] ; do
wait "$pid"
done
if [ -f /var/tmp/bunkerweb/ui.healthy ] ; then
rm /var/tmp/bunkerweb/ui.healthy
fi
log "ENTRYPOINT" "" "Web UI stopped"
exit 0