From 914a29de7ac9cfcd0b8c73ae8d671f73991d64f6 Mon Sep 17 00:00:00 2001 From: Akira Yamamoto <3007213+akirayamamoto@users.noreply.github.com> Date: Tue, 9 Jun 2026 18:25:14 +1000 Subject: [PATCH] docker: simplify Alpine PHP ini install --- Dockerfile.alpine | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Dockerfile.alpine b/Dockerfile.alpine index 5290d0a..1eecd35 100755 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -20,19 +20,15 @@ RUN apk add --quiet --no-cache \ RUN ln -sf /dev/stdout /var/log/apache2/access.log && \ ln -sf /dev/stderr /var/log/apache2/error.log -# Alpine installs PHP from apk; php-apache2 reads /etc/phpXX/conf.d. -# Use the versioned apk conf.d without pinning the PHP major. +# Use PHP's scan dir without pinning the apk PHP major. COPY docker/librespeed-php.ini /tmp/librespeed-php.ini RUN set -eu; \ - scan_dir=""; \ - for d in /etc/php*/conf.d; do \ - [ -d "$d" ] && scan_dir="$d" && break; \ - done; \ + scan_dir="$(php -r 'echo rtrim(PHP_CONFIG_FILE_SCAN_DIR);')"; \ if [ -z "$scan_dir" ]; then \ - echo "ERROR: no /etc/php*/conf.d directory found; apk php-apache2 install layout may have changed" >&2; \ + echo "ERROR: PHP_CONFIG_FILE_SCAN_DIR is empty" >&2; \ exit 1; \ fi; \ - install -D -m 0644 /tmp/librespeed-php.ini "$scan_dir/99-librespeed.ini"; \ + install -m 0644 /tmp/librespeed-php.ini "$scan_dir/99-librespeed.ini"; \ rm /tmp/librespeed-php.ini # Prepare files and folders