chore: wait for postgres in docker compose

This commit is contained in:
Ali BARIN
2022-08-31 21:28:35 +02:00
parent 827fef8a05
commit 6e9a9992c0
2 changed files with 15 additions and 1 deletions

View File

@@ -0,0 +1,11 @@
#!/bin/sh
set -e
until psql -h "$POSTGRES_HOST" -U "$POSTGRES_USERNAME" -d "$POSTGRES_HOST" -c '\q'; do
>&2 echo "Postgres is unavailable - sleeping"
sleep 1
done
>&2 echo "Postgres is up - executing command"
exec "$@"