fix: wait for postgres before running migrations on startup

App was crash-looping when the host restarted and Docker brought up the
app container before postgres was ready. Added a pg_isready poll loop in
entrypoint.sh and installed postgresql-client in the image.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Kevin Welvaert ATA IT 2026-05-27 09:12:08 +02:00
parent 92b3afe9d6
commit 80a6c1e140
2 changed files with 8 additions and 0 deletions

View file

@ -1,4 +1,10 @@
#!/bin/sh
set -e
until pg_isready -q -h postgres; do
echo "Waiting for postgres..."
sleep 2
done
alembic upgrade head
exec uvicorn corvid.main:app --host 0.0.0.0 --port 8080