![google-labs-jules[bot]](/assets/img/avatar_default.png)
This commit introduces changes to ensure that Alembic database migrations are automatically applied when the backend Docker container starts. Key changes: - Added `be/entrypoint.sh`: This script first runs `alembic upgrade head` to apply any pending migrations and then executes the main container command (e.g., starting Uvicorn). - Modified `be/Dockerfile`: - The `entrypoint.sh` script is copied into the image and made executable. - The Docker `ENTRYPOINT` is set to this script, ensuring migrations run before the application starts. - Updated `docker-compose.yml`: - The `DATABASE_URL` for the `backend` service has been set to the Neon database URL you provided. - Verified `be/alembic/env.py`: Confirmed that it correctly sources the `DATABASE_URL` from environment variables for Alembic to use. These changes address the issue where migrations were not being run, preventing the application from starting correctly.
11 lines
202 B
Bash
Executable File
11 lines
202 B
Bash
Executable File
#!/bin/sh
|
|
set -e
|
|
|
|
# Run database migrations
|
|
echo "Running database migrations..."
|
|
alembic upgrade head
|
|
|
|
# Execute the command passed as arguments to this script
|
|
echo "Starting application..."
|
|
exec "$@"
|