File size: 556 Bytes
2b86c60 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #!/bin/sh
# Container entrypoint: migrate, then run the worker and the API together. If either process
# exits, stop the other and exit non-zero so the platform restarts the container.
set -eu
python -m backend.flagship.manage migrate
python -m backend.flagship.worker &
worker=$!
uvicorn backend.api.main:app --host 0.0.0.0 --port "${PORT:-7860}" --no-access-log &
api=$!
trap 'kill "$worker" "$api" 2>/dev/null' TERM INT
while kill -0 "$worker" 2>/dev/null && kill -0 "$api" 2>/dev/null; do sleep 5; done
kill "$worker" "$api" 2>/dev/null || true
exit 1
|