Files

32 lines
793 B
Bash
Raw Permalink Normal View History

2026-09-13 20:07:03 +01:00
#!/bin/bash
# Start both the main app (port 8000) and the admin panel (port 8001).
# If either exits, kill the whole container so Docker's restart policy fires.
set -e
cleanup() {
echo "Shutting down…"
kill -TERM "$MAIN_PID" "$ADMIN_PID" 2>/dev/null || true
wait
exit 0
}
trap cleanup SIGINT SIGTERM
cd /app/backend
echo "[start] Main app on :8000"
uvicorn app:app --host 0.0.0.0 --port 8000 --proxy-headers &
MAIN_PID=$!
echo "[start] Admin panel on :8001"
uvicorn admin_app:app --host 0.0.0.0 --port 8001 --proxy-headers &
ADMIN_PID=$!
# Wait for either to exit
wait -n "$MAIN_PID" "$ADMIN_PID"
EXIT_CODE=$?
echo "[exit] One of the services exited with code $EXIT_CODE; stopping the other"
kill -TERM "$MAIN_PID" "$ADMIN_PID" 2>/dev/null || true
wait
exit $EXIT_CODE