Spaces:
Running
Running

Enhance Docker setup: update docker-entrypoint.sh to set PYTHONPATH, modify Dockerfile to create a proper package structure and adjust permissions for storage and migrations directories; update migrations/env.py to include application root in Python path.
6712559
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 |