#!/bin/bash set -e echo "⏳ Waiting for PostgreSQL..." # Wait for PostgreSQL to be ready until pg_isready -h "$POSTGRES_HOST" -U "$POSTGRES_USER" -d "$POSTGRES_DB"; do echo " (waiting for database...)" sleep 2 done echo "✅ PostgreSQL is up!" echo "🔄 Running Database Migrations..." # Run migrations alembic upgrade head echo "🚀 Starting Uvicorn Server..." # Execute the passed command (CMD) exec "$@"