mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 19:01:39 -04:00
Running alembic migrations whenever api container is started.
This commit is contained in:
parent
78a83dc63e
commit
833f58dbfb
9 changed files with 131 additions and 28 deletions
17
docker/api/entrypoint.sh
Normal file
17
docker/api/entrypoint.sh
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue