diff --git a/docker-compose.yml b/docker-compose.yml index 6538aaa..a2f204d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,7 +35,7 @@ services: # MySQL 8 defaults to caching_sha2_password; keep native auth for broad client compat command: --default-authentication-plugin=mysql_native_password healthcheck: - test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "videodb", "-pvideodb_secret"] + test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "--silent"] interval: 10s timeout: 5s retries: 12 diff --git a/videodb/Dockerfile b/videodb/Dockerfile index b458b72..ac97eb4 100644 --- a/videodb/Dockerfile +++ b/videodb/Dockerfile @@ -6,7 +6,6 @@ RUN apt-get update && apt-get install -y \ libjpeg-dev \ libfreetype6-dev \ libonig-dev \ - default-mysql-client \ && rm -rf /var/lib/apt/lists/* # Install PHP extensions needed by videoDB diff --git a/videodb/docker-entrypoint.sh b/videodb/docker-entrypoint.sh index 9939062..55cd4b5 100644 --- a/videodb/docker-entrypoint.sh +++ b/videodb/docker-entrypoint.sh @@ -62,9 +62,9 @@ PHP chown www-data:www-data "$CONFIG_FILE" echo "[entrypoint] config.inc.php written." -# ── Wait for MySQL ───────────────────────────────────────────────────────────── +# ── Wait for MySQL (use PHP mysqlnd — same driver the app uses) ──────────────── echo "[entrypoint] Waiting for MySQL at ${DB_HOST}..." -until mysqladmin ping -h "$DB_HOST" -u "$DB_USER" -p"$DB_PASSWORD" --silent 2>/dev/null; do +until php -r "exit(@mysqli_connect('${DB_HOST}','${DB_USER}','${DB_PASSWORD}','${DB_NAME}') ? 0 : 1);" 2>/dev/null; do printf "." sleep 2 done