#!/bin/sh set -eu # Starts as root only to fix ownership of the bind-mounted data directory, # then drops to the unprivileged "app" user for migrations and the server. if [ "$(id -u)" = "0" ]; then mkdir -p /data/files if [ "$(stat -c %u /data)" != "1000" ]; then chown -R app:app /data fi exec setpriv --reuid=app --regid=app --init-groups "$0" "$@" fi cd /app alembic upgrade head exec uvicorn app.main:app \ --host 0.0.0.0 \ --port 8000 \ --workers 1 \ --ws-max-size 65536 \ --proxy-headers \ --forwarded-allow-ips "${FORWARDED_ALLOW_IPS:-127.0.0.1}" \ --log-level "${LOG_LEVEL:-info}"