From 45eda5e6832b7495174ec6457c9bab2b7568f4fd Mon Sep 17 00:00:00 2001 From: Anatoly Pashin Date: Tue, 4 Oct 2022 18:27:41 +0800 Subject: [PATCH] Use php extensions installer https://github.com/mlocati/docker-php-extension-installer Fixes https://github.com/dunglas/symfony-docker/issues/276 --- Dockerfile | 44 ++++++++++---------------------------------- 1 file changed, 10 insertions(+), 34 deletions(-) diff --git a/Dockerfile b/Dockerfile index bde352f..fc53ae1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,6 +22,10 @@ ENV APP_ENV=prod WORKDIR /srv/app +# php extensions installer: https://github.com/mlocati/docker-php-extension-installer +ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ +RUN chmod +x /usr/local/bin/install-php-extensions + # persistent / runtime deps RUN apk add --no-cache \ acl \ @@ -32,37 +36,12 @@ RUN apk add --no-cache \ ; RUN set -eux; \ - apk add --no-cache --virtual .build-deps \ - $PHPIZE_DEPS \ - icu-data-full \ - icu-dev \ - libzip-dev \ - zlib-dev \ - ; \ - \ - docker-php-ext-configure zip; \ - docker-php-ext-install -j$(nproc) \ - intl \ - zip \ - ; \ - pecl install \ - apcu \ - ; \ - pecl clear-cache; \ - docker-php-ext-enable \ - apcu \ + install-php-extensions \ + intl \ + zip \ + apcu \ opcache \ - ; \ - \ - runDeps="$( \ - scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \ - | tr ',' '\n' \ - | sort -u \ - | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - )"; \ - apk add --no-cache --virtual .app-phpexts-rundeps $runDeps; \ - \ - apk del .build-deps + ; ###> recipes ### ###< recipes ### @@ -125,10 +104,7 @@ RUN rm $PHP_INI_DIR/conf.d/app.prod.ini; \ COPY docker/php/conf.d/app.dev.ini $PHP_INI_DIR/conf.d/ RUN set -eux; \ - apk add --no-cache --virtual .build-deps $PHPIZE_DEPS; \ - pecl install xdebug; \ - docker-php-ext-enable xdebug; \ - apk del .build-deps + install-php-extensions xdebug RUN rm -f .env.local.php