mirror of
https://github.com/tmdinosaurcenter/kiosk-guestbook.git
synced 2026-06-04 00:17:44 -06:00
05bcf10614
Entrypoint now runs as root, chowns the data directory to appuser, then drops privileges via gosu before starting Gunicorn. This prevents sqlite3.OperationalError on mounted volumes owned by root.
13 lines
572 B
Bash
13 lines
572 B
Bash
#!/bin/sh
|
|
# 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 app:app --workers ${GUNICORN_WORKERS:-3}
|