#!/bin/sh set -e echo "[api] running database migrations..." attempt=0 until alembic upgrade head; do attempt=$((attempt + 1)) if [ "$attempt" -ge 12 ]; then echo "[api] migrations failed after $attempt attempts, giving up." >&2 exit 1 fi echo "[api] database not ready (attempt $attempt), retrying in 5s..." sleep 5 done echo "[api] migrations complete." exec uvicorn app.main:app --host 0.0.0.0 --port 8000 --workers 2