Spaces:
Paused
Paused
| set -euo pipefail | |
| # venv activate | |
| if [ -f "/home/user/app/.venv/bin/activate" ]; then | |
| source /home/user/app/.venv/bin/activate | |
| fi | |
| export PORT="${PORT:-7860}" | |
| echo "[entrypoint] starting robot-server..." | |
| (cd /root/opentrons && make -C robot-server dev-flex) > /tmp/robot-server.log 2>&1 & | |
| ROBOT_SERVER_PID=$! | |
| echo "[entrypoint] robot-server pid=${ROBOT_SERVER_PID}" | |
| echo "[entrypoint] waiting for robot-server (127.0.0.1:31950)..." | |
| for i in {1..60}; do | |
| if (echo > /dev/tcp/127.0.0.1/31950) >/dev/null 2>&1; then | |
| echo "[entrypoint] robot-server is up" | |
| break | |
| fi | |
| if ! kill -0 "${ROBOT_SERVER_PID}" >/dev/null 2>&1; then | |
| echo "[entrypoint] robot-server exited early. Last logs:" | |
| tail -n 200 /tmp/robot-server.log || true | |
| exit 1 | |
| fi | |
| sleep 1 | |
| done | |
| echo "[entrypoint] starting FastAPI on 0.0.0.0:${PORT} ..." | |
| exec uvicorn api:app --app-dir /home/user/app --host 0.0.0.0 --port "${PORT}" | |