#!/usr/bin/env sh
set -e

echo "Waiting for database..."
python -m app.wait_for_db

echo "Running migrations..."
alembic upgrade head

echo "Starting API..."
exec gunicorn app.main:app \
  -k uvicorn.workers.UvicornWorker \
  --bind 0.0.0.0:8000 \
  --workers 2 \
  --timeout 60
