From 7809dce47413a06ece142d049e3072b1565f2c72 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 16 Aug 2026 09:38:29 +0200 Subject: [PATCH] 57 - Fix MySQL readiness check and bump CI image to php8.3-2 --- .forgejo/workflows/ci.yml | 9 +++++++-- .forgejo/workflows/images.yml | 2 +- docker/build/Dockerfile.ci | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index ad9db61..5a58da1 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: ci: runs-on: docker container: - image: forge.lvl0.xyz/lvl0/incr-ci:php8.3-1 + image: forge.lvl0.xyz/lvl0/incr-ci:php8.3-2 services: db: @@ -40,10 +40,15 @@ jobs: - name: Wait for MySQL run: | for i in $(seq 1 30); do - nc -z db 3306 && echo "MySQL is up" && break + if php -r 'exit(@fsockopen("db", 3306) ? 0 : 1);'; then + echo "MySQL is up after ${i} attempt(s)" + exit 0 + fi echo "Waiting for MySQL... ($i/30)" sleep 2 done + echo "MySQL never became reachable on db:3306" >&2 + exit 1 - name: Run migrations run: php artisan migrate --force diff --git a/.forgejo/workflows/images.yml b/.forgejo/workflows/images.yml index 08de3a4..a098759 100644 --- a/.forgejo/workflows/images.yml +++ b/.forgejo/workflows/images.yml @@ -20,7 +20,7 @@ jobs: include: - name: incr-ci file: docker/build/Dockerfile.ci - version: php8.3-1 + version: php8.3-2 steps: - uses: https://data.forgejo.org/actions/checkout@v4 diff --git a/docker/build/Dockerfile.ci b/docker/build/Dockerfile.ci index 512019c..02e53f2 100644 --- a/docker/build/Dockerfile.ci +++ b/docker/build/Dockerfile.ci @@ -25,11 +25,11 @@ RUN install-php-extensions \ gd \ pcov -# netcat-openbsd backs the MySQL readiness check in ci.yml. # nodejs is not used by the app's tests; the Forgejo JavaScript actions # (checkout, cache) are executed with it inside this container. +# The MySQL readiness check in ci.yml uses PHP's fsockopen, so no netcat here. RUN apt-get update \ - && apt-get install -y --no-install-recommends git unzip nodejs netcat-openbsd \ + && apt-get install -y --no-install-recommends git unzip nodejs \ && rm -rf /var/lib/apt/lists/* COPY --from=composer:2 /usr/bin/composer /usr/bin/composer