docker: simplify Alpine PHP ini install

This commit is contained in:
Akira Yamamoto 2026-06-09 18:25:14 +10:00
parent a30872a4e8
commit 914a29de7a

View file

@ -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