- Multi-Stage-Build: Node baut das Frontend, python:3.13-slim liefert aus - Entrypoint setzt Rechte für /data, migriert und startet Uvicorn als UID 1000 - Port nur an die LAN-IP gebunden (192.168.50.123:8085) - Healthcheck gegen /api/health, reduzierte Capabilities, Speicherlimit Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
24 lines
618 B
Bash
Executable File
24 lines
618 B
Bash
Executable File
#!/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 \
|
|
--proxy-headers \
|
|
--forwarded-allow-ips "${FORWARDED_ALLOW_IPS:-127.0.0.1}" \
|
|
--log-level "${LOG_LEVEL:-info}"
|