Spaces:
Running
Running
| set -e | |
| export UNSPSC_DB_PATH="${UNSPSC_DB_PATH:-/app/data/unspsc.db}" | |
| cd /app | |
| uvicorn server.main:app --host 127.0.0.1 --port 8000 & | |
| # Wait for API before nginx serves /api (avoids 502/504 on cold start) | |
| i=0 | |
| while [ "$i" -lt 60 ]; do | |
| if python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/api/health', timeout=2)" 2>/dev/null; then | |
| break | |
| fi | |
| i=$((i + 1)) | |
| sleep 1 | |
| done | |
| exec nginx -g "daemon off;" | |