PRMSChallenge / start.sh
vineelagampa's picture
Create start.sh
86fc6c2 verified
raw
history blame contribute delete
416 Bytes
#!/usr/bin/env bash
set -euo pipefail
API_PORT="${PORT:-7860}"
WEB_PORT="${WEB_PORT:-8002}"
WEB_DIR="${WEB_DIR:-/app/web}"
uvicorn backend:app --host 0.0.0.0 --port "$API_PORT" --proxy-headers --forwarded-allow-ips='*' &
API_PID=$!
python -m http.server "$WEB_PORT" --directory "$WEB_DIR" &
HTTP_PID=$!
trap 'kill -TERM "$API_PID" "$HTTP_PID"; wait "$API_PID" "$HTTP_PID"' INT TERM
wait -n "$API_PID" "$HTTP_PID"