mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
chore: Update entrypoint.sh script for web UI Docker container
This commit is contained in:
parent
c61f0d1784
commit
1669dab8ba
1 changed files with 28 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue