#!/bin/sh set -e # Ensure proper Python path export PYTHONPATH=/app:${PYTHONPATH} # Wait for database to be ready (if using PostgreSQL) if [ "$DATABASE_URL" != "${DATABASE_URL#postgresql://}" ]; then echo "Waiting for PostgreSQL to be ready..." while ! nc -z db 5432; do sleep 0.1 done echo "PostgreSQL is ready" fi # Run database migrations echo "Running database migrations..." cd /app && alembic upgrade head # Start the application echo "Starting the application..." exec python -m app.main