File size: 416 Bytes
86fc6c2
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/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"