Running alembic migrations whenever api container is started.

This commit is contained in:
Roland 2025-06-29 18:38:32 -06:00
parent 78a83dc63e
commit 833f58dbfb
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
9 changed files with 131 additions and 28 deletions

17
docker/api/entrypoint.sh Normal file
View file

@ -0,0 +1,17 @@
#!/bin/bash
set -e
# Wait for PostgreSQL to be ready
echo "Waiting for PostgreSQL..."
until pg_isready -h db -p 5432 -U postgres; do
echo "PostgreSQL not ready, waiting..."
sleep 2
done
# Run Alembic migrations
echo "Running Alembic migrations..."
python3 -m alembic upgrade head
# Start Sanic service
echo "Starting Sanic service..."
exec python3 -OO /opt/wrolpi/main.py -v api --host 0.0.0.0