Files
kiosk-guestbook/entrypoint.sh
T
steve 898441af0c fix: add set -e and gunicorn worker timeout to entrypoint
set -e ensures the script aborts on any error (e.g. failed chown)
rather than silently continuing. --timeout 30 kills hung workers to
prevent slow-client attacks from exhausting the worker pool.
2026-03-28 23:23:53 -06:00

19 lines
617 B
Bash

#!/bin/sh
set -e
# Fix ownership of the data directory so appuser can write the database.
# This runs as root (no USER directive in Dockerfile) and is safe because
# we immediately drop privileges via gosu before starting the app.
DATA_DIR=$(dirname "${DATABASE_PATH:-/data/guestbook.db}")
chown -R appuser:appuser "$DATA_DIR"
# Process index.html.template to create index.html
envsubst < /app/templates/index.html.template > /app/templates/index.html
# Drop to appuser and start Gunicorn
exec gosu appuser gunicorn \
--bind 0.0.0.0:8000 \
--workers ${GUNICORN_WORKERS:-3} \
--timeout 30 \
app:app