Quellcode durchsuchen

docker: simplify Alpine PHP ini install

Akira Yamamoto vor 1 Monat
Ursprung
Commit
914a29de7a
1 geänderte Dateien mit 4 neuen und 8 gelöschten Zeilen
  1. 4 8
      Dockerfile.alpine

+ 4 - 8
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