Make PECL installs fail-fast with retries; harden integration test

This commit is contained in:
jkaninda committed 2026-10-21 23:08:55 +02:00
1 parent 1b1be8f55a
commit 857101583b
3 files changed
+19 -4

No files matched your search

+8 -1
View File
@@ -65,7 +65,14 @@ RUN set -eux; \
libxml2-dev libzip-dev zlib1g-dev; \
docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp; \
docker-php-ext-install -j"$(nproc)" bcmath exif gd intl mbstring pcntl pdo_mysql pdo_pgsql zip; \
pecl install redis memcached rdkafka; \
# One extension per call with retries: pecl does not fail when one of several packages fails
for ext in redis memcached rdkafka; do \
n=0; \
until pecl install -f "$ext" && [ -f "$(php-config --extension-dir)/$ext.so" ]; do \
n=$((n + 1)); [ "$n" -ge 3 ] && { echo "pecl install $ext failed"; exit 1; }; \
sleep 10; \
done; \
done; \
docker-php-ext-enable redis memcached rdkafka; \
# OPcache is always compiled in since PHP 8.5
if ! php -m | grep -qi '^zend opcache$'; then docker-php-ext-install opcache; fi; \
+8 -1
View File
@@ -51,7 +51,14 @@ RUN set -eux; \
libxml2-dev libzip-dev zlib-dev cyrus-sasl-dev linux-headers; \
docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp; \
docker-php-ext-install -j"$(nproc)" bcmath exif gd intl mbstring pcntl pdo_mysql pdo_pgsql zip; \
pecl install redis memcached rdkafka; \
# One extension per call with retries: pecl does not fail when one of several packages fails
for ext in redis memcached rdkafka; do \
n=0; \
until pecl install -f "$ext" && [ -f "$(php-config --extension-dir)/$ext.so" ]; do \
n=$((n + 1)); [ "$n" -ge 3 ] && { echo "pecl install $ext failed"; exit 1; }; \
sleep 10; \
done; \
done; \
docker-php-ext-enable redis memcached rdkafka; \
# OPcache is always compiled in since PHP 8.5
if ! php -m | grep -qi '^zend opcache$'; then docker-php-ext-install opcache; fi; \
+3 -2
View File
@@ -21,7 +21,7 @@ docker run --rm "$IMAGE" php -m > modules.txt
for ext in bcmath exif gd intl mbstring memcached pcntl pdo_mysql pdo_pgsql rdkafka redis zip "Zend OPcache"; do
grep -qx "$ext" modules.txt || { echo "Missing extension: $ext"; exit 1; }
done
if docker run --rm "$IMAGE" php -m 2>&1 | grep -iE 'warning|unable to load'; then
if docker run --rm "$IMAGE" sh -c 'php -m 2>&1' 2>/dev/null | grep -iE 'warning|unable to load'; then
echo "PHP startup warnings detected"; exit 1
fi
rm -f modules.txt
@@ -50,7 +50,8 @@ echo "==> Running migrations"
docker exec --user www-data php-fpm php artisan migrate --force
echo "==> Checking HTTP response"
code=$(curl -s -o /dev/null -w '%{http_code}' "http://localhost:$HTTP_PORT")
# Request Nginx from inside the compose network so host port conflicts cannot interfere
code=$(docker exec php-fpm curl -s -o /dev/null -w '%{http_code}' http://nginx-server)
echo "HTTP $code"
[ "$code" = "200" ]