From f4bcf72b9b7bcb8636ca3f2279702a4210c10e89 Mon Sep 17 00:00:00 2001 From: Bryson Date: Mon, 26 May 2025 22:26:27 -0500 Subject: [PATCH] db ready --- entrypoint.sh | 9 +++++++++ 1 file changed, 9 insertions(+) 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"