diff --git a/entrypoint.sh b/entrypoint.sh index 39f6adb..9f7c14d 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,6 +1,15 @@ #!/bin/bash set -e +# Wait for the database service to be ready +DB_HOST=${DB_HOST:-db} +DB_PORT=${DB_PORT:-3306} +echo "[⏳] Waiting for database at $DB_HOST:$DB_PORT..." +until nc -z $DB_HOST $DB_PORT; do + sleep 1 +done +echo "[✔] Database is up and reachable" + # Initialize migrations folder if needed if [ ! -d migrations ]; then echo "[✔] Initializing migrations directory"