diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template index c01d81a..822a956 100644 --- a/Dockerfile-alpine.template +++ b/Dockerfile-alpine.template @@ -2,7 +2,7 @@ FROM php:7.2-%%VARIANT%% # docker-entrypoint.sh dependencies RUN apk add --no-cache \ - bash + bash # Install dependencies RUN set -ex; \ @@ -28,6 +28,27 @@ RUN set -ex; \ apk add --virtual .phpmyadmin-phpexts-rundeps $runDeps; \ apk del .build-deps +# set recommended PHP.ini settings +# see https://secure.php.net/manual/en/opcache.installation.php +RUN { \ + echo 'opcache.memory_consumption=128'; \ + echo 'opcache.interned_strings_buffer=8'; \ + echo 'opcache.max_accelerated_files=4000'; \ + echo 'opcache.revalidate_freq=2'; \ + echo 'opcache.fast_shutdown=1'; \ + } > /usr/local/etc/php/conf.d/opcache-recommended.ini; \ + \ + { \ + echo 'session.cookie_httponly = 1'; \ + echo 'session.use_strict_mode = 1'; \ + } > /usr/local/etc/php/conf.d/session-strict.ini; \ + \ + { \ + echo 'allow_url_fopen = Off'; \ + echo 'max_execution_time = 600'; \ + echo 'memory_limit = 512M'; \ + } > /usr/local/etc/php/conf.d/phpmyadmin-misc.ini + # Calculate download URL ENV VERSION %%VERSION%% ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz @@ -62,7 +83,6 @@ RUN set -ex; \ # Copy configuration COPY config.inc.php /etc/phpmyadmin/config.inc.php -COPY php.ini /usr/local/etc/php/conf.d/php-phpmyadmin.ini # Copy main script COPY docker-entrypoint.sh /docker-entrypoint.sh diff --git a/Dockerfile-debian.template b/Dockerfile-debian.template index 3413cfe..769677c 100644 --- a/Dockerfile-debian.template +++ b/Dockerfile-debian.template @@ -2,34 +2,55 @@ FROM php:7.2-%%VARIANT%% # Install dependencies RUN set -ex; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - libbz2-dev \ - libfreetype6-dev \ - libjpeg-dev \ - libpng-dev \ - libwebp-dev \ - libxpm-dev \ - ; \ - \ - docker-php-ext-configure gd --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-webp-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr; \ - docker-php-ext-install bz2 gd mysqli opcache zip; \ - \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark; \ - ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ - | awk '/=>/ { print $3 }' \ - | sort -u \ - | xargs -r dpkg-query -S \ - | cut -d: -f1 \ - | sort -u \ - | xargs -rt apt-mark manual; \ - \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/* + \ + savedAptMark="$(apt-mark showmanual)"; \ + \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + libbz2-dev \ + libfreetype6-dev \ + libjpeg-dev \ + libpng-dev \ + libwebp-dev \ + libxpm-dev \ + ; \ + \ + docker-php-ext-configure gd --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-webp-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr; \ + docker-php-ext-install bz2 gd mysqli opcache zip; \ + \ + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark; \ + ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ + | awk '/=>/ { print $3 }' \ + | sort -u \ + | xargs -r dpkg-query -S \ + | cut -d: -f1 \ + | sort -u \ + | xargs -rt apt-mark manual; \ + \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + rm -rf /var/lib/apt/lists/* + +# set recommended PHP.ini settings +# see https://secure.php.net/manual/en/opcache.installation.php +RUN { \ + echo 'opcache.memory_consumption=128'; \ + echo 'opcache.interned_strings_buffer=8'; \ + echo 'opcache.max_accelerated_files=4000'; \ + echo 'opcache.revalidate_freq=2'; \ + echo 'opcache.fast_shutdown=1'; \ + } > /usr/local/etc/php/conf.d/opcache-recommended.ini; \ + \ + { \ + echo 'session.cookie_httponly = 1'; \ + echo 'session.use_strict_mode = 1'; \ + } > /usr/local/etc/php/conf.d/session-strict.ini; \ + \ + { \ + echo 'allow_url_fopen = Off'; \ + echo 'max_execution_time = 600'; \ + echo 'memory_limit = 512M'; \ + } > /usr/local/etc/php/conf.d/phpmyadmin-misc.ini # Calculate download URL ENV VERSION %%VERSION%% @@ -70,7 +91,6 @@ RUN set -ex; \ # Copy configuration COPY config.inc.php /etc/phpmyadmin/config.inc.php -COPY php.ini /usr/local/etc/php/conf.d/php-phpmyadmin.ini # Copy main script COPY docker-entrypoint.sh /docker-entrypoint.sh diff --git a/apache/Dockerfile b/apache/Dockerfile index 8419655..9035741 100644 --- a/apache/Dockerfile +++ b/apache/Dockerfile @@ -2,34 +2,56 @@ FROM php:7.2-apache # Install dependencies RUN set -ex; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - libbz2-dev \ - libfreetype6-dev \ - libjpeg-dev \ - libpng-dev \ - libwebp-dev \ - libxpm-dev \ - ; \ - \ - docker-php-ext-configure gd --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-webp-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr; \ - docker-php-ext-install bz2 gd mysqli opcache zip; \ - \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark; \ - ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ - | awk '/=>/ { print $3 }' \ - | sort -u \ - | xargs -r dpkg-query -S \ - | cut -d: -f1 \ - | sort -u \ - | xargs -rt apt-mark manual; \ - \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/* + \ + savedAptMark="$(apt-mark showmanual)"; \ + \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + libbz2-dev \ + libfreetype6-dev \ + libjpeg-dev \ + libpng-dev \ + libwebp-dev \ + libxpm-dev \ + ; \ + \ + docker-php-ext-configure gd --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-webp-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr; \ + docker-php-ext-install bz2 gd mysqli opcache zip; \ + \ + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark; \ + ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ + | awk '/=>/ { print $3 }' \ + | sort -u \ + | xargs -r dpkg-query -S \ + | cut -d: -f1 \ + | sort -u \ + | xargs -rt apt-mark manual; \ + \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + rm -rf /var/lib/apt/lists/* + +# set recommended PHP.ini settings +# see https://secure.php.net/manual/en/opcache.installation.php +RUN { \ + echo 'opcache.memory_consumption=128'; \ + echo 'opcache.interned_strings_buffer=8'; \ + echo 'opcache.max_accelerated_files=4000'; \ + echo 'opcache.revalidate_freq=2'; \ + echo 'opcache.fast_shutdown=1'; \ + echo 'opcache.enable_cli=1'; \ + } > /usr/local/etc/php/conf.d/opcache-recommended.ini; \ + \ + { \ + echo 'session.cookie_httponly = 1'; \ + echo 'session.use_strict_mode = 1'; \ + } > /usr/local/etc/php/conf.d/session-strict.ini; \ + \ + { \ + echo 'allow_url_fopen = Off'; \ + echo 'max_execution_time = 600'; \ + echo 'memory_limit = 512M'; \ + } > /usr/local/etc/php/conf.d/phpmyadmin-misc.ini # Calculate download URL ENV VERSION 4.9.0.1 @@ -70,7 +92,6 @@ RUN set -ex; \ # Copy configuration COPY config.inc.php /etc/phpmyadmin/config.inc.php -COPY php.ini /usr/local/etc/php/conf.d/php-phpmyadmin.ini # Copy main script COPY docker-entrypoint.sh /docker-entrypoint.sh diff --git a/apache/php.ini b/apache/php.ini deleted file mode 100644 index 3dad93a..0000000 --- a/apache/php.ini +++ /dev/null @@ -1,20 +0,0 @@ -[PHP] -allow_url_fopen = Off -max_execution_time = 600 -memory_limit = 512M -open_basedir = /var/www/html:/tmp/:/etc/phpmyadmin/ -post_max_size = 512M -upload_max_filesize = 512M - -[Session] -session.cookie_httponly = 1 -session.hash_function = 1 -session.save_path = "/sessions" -session.use_strict_mode = 1 - -[opcache] -opcache.fast_shutdown = 1 -opcache.restrict_api = /disabled/ -opcache.save_comments = 0 -opcache.use_cwd = 0 -opcache.validate_timestamps = 0 diff --git a/fpm-alpine/Dockerfile b/fpm-alpine/Dockerfile index e30a370..14b364c 100644 --- a/fpm-alpine/Dockerfile +++ b/fpm-alpine/Dockerfile @@ -2,7 +2,7 @@ FROM php:7.2-fpm-alpine # docker-entrypoint.sh dependencies RUN apk add --no-cache \ - bash + bash # Install dependencies RUN set -ex; \ @@ -28,6 +28,28 @@ RUN set -ex; \ apk add --virtual .phpmyadmin-phpexts-rundeps $runDeps; \ apk del .build-deps +# set recommended PHP.ini settings +# see https://secure.php.net/manual/en/opcache.installation.php +RUN { \ + echo 'opcache.memory_consumption=128'; \ + echo 'opcache.interned_strings_buffer=8'; \ + echo 'opcache.max_accelerated_files=4000'; \ + echo 'opcache.revalidate_freq=2'; \ + echo 'opcache.fast_shutdown=1'; \ + echo 'opcache.enable_cli=1'; \ + } > /usr/local/etc/php/conf.d/opcache-recommended.ini; \ + \ + { \ + echo 'session.cookie_httponly = 1'; \ + echo 'session.use_strict_mode = 1'; \ + } > /usr/local/etc/php/conf.d/session-strict.ini; \ + \ + { \ + echo 'allow_url_fopen = Off'; \ + echo 'max_execution_time = 600'; \ + echo 'memory_limit = 512M'; \ + } > /usr/local/etc/php/conf.d/phpmyadmin-misc.ini + # Calculate download URL ENV VERSION 4.9.0.1 ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz @@ -62,7 +84,6 @@ RUN set -ex; \ # Copy configuration COPY config.inc.php /etc/phpmyadmin/config.inc.php -COPY php.ini /usr/local/etc/php/conf.d/php-phpmyadmin.ini # Copy main script COPY docker-entrypoint.sh /docker-entrypoint.sh diff --git a/fpm-alpine/php.ini b/fpm-alpine/php.ini deleted file mode 100644 index 3dad93a..0000000 --- a/fpm-alpine/php.ini +++ /dev/null @@ -1,20 +0,0 @@ -[PHP] -allow_url_fopen = Off -max_execution_time = 600 -memory_limit = 512M -open_basedir = /var/www/html:/tmp/:/etc/phpmyadmin/ -post_max_size = 512M -upload_max_filesize = 512M - -[Session] -session.cookie_httponly = 1 -session.hash_function = 1 -session.save_path = "/sessions" -session.use_strict_mode = 1 - -[opcache] -opcache.fast_shutdown = 1 -opcache.restrict_api = /disabled/ -opcache.save_comments = 0 -opcache.use_cwd = 0 -opcache.validate_timestamps = 0 diff --git a/fpm/Dockerfile b/fpm/Dockerfile index e25e40d..d3fda5d 100644 --- a/fpm/Dockerfile +++ b/fpm/Dockerfile @@ -2,34 +2,56 @@ FROM php:7.2-fpm # Install dependencies RUN set -ex; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - libbz2-dev \ - libfreetype6-dev \ - libjpeg-dev \ - libpng-dev \ - libwebp-dev \ - libxpm-dev \ - ; \ - \ - docker-php-ext-configure gd --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-webp-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr; \ - docker-php-ext-install bz2 gd mysqli opcache zip; \ - \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark; \ - ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ - | awk '/=>/ { print $3 }' \ - | sort -u \ - | xargs -r dpkg-query -S \ - | cut -d: -f1 \ - | sort -u \ - | xargs -rt apt-mark manual; \ - \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/* + \ + savedAptMark="$(apt-mark showmanual)"; \ + \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + libbz2-dev \ + libfreetype6-dev \ + libjpeg-dev \ + libpng-dev \ + libwebp-dev \ + libxpm-dev \ + ; \ + \ + docker-php-ext-configure gd --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-webp-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr; \ + docker-php-ext-install bz2 gd mysqli opcache zip; \ + \ + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark; \ + ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ + | awk '/=>/ { print $3 }' \ + | sort -u \ + | xargs -r dpkg-query -S \ + | cut -d: -f1 \ + | sort -u \ + | xargs -rt apt-mark manual; \ + \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + rm -rf /var/lib/apt/lists/* + +# set recommended PHP.ini settings +# see https://secure.php.net/manual/en/opcache.installation.php +RUN { \ + echo 'opcache.memory_consumption=128'; \ + echo 'opcache.interned_strings_buffer=8'; \ + echo 'opcache.max_accelerated_files=4000'; \ + echo 'opcache.revalidate_freq=2'; \ + echo 'opcache.fast_shutdown=1'; \ + echo 'opcache.enable_cli=1'; \ + } > /usr/local/etc/php/conf.d/opcache-recommended.ini; \ + \ + { \ + echo 'session.cookie_httponly = 1'; \ + echo 'session.use_strict_mode = 1'; \ + } > /usr/local/etc/php/conf.d/session-strict.ini; \ + \ + { \ + echo 'allow_url_fopen = Off'; \ + echo 'max_execution_time = 600'; \ + echo 'memory_limit = 512M'; \ + } > /usr/local/etc/php/conf.d/phpmyadmin-misc.ini # Calculate download URL ENV VERSION 4.9.0.1 @@ -70,7 +92,6 @@ RUN set -ex; \ # Copy configuration COPY config.inc.php /etc/phpmyadmin/config.inc.php -COPY php.ini /usr/local/etc/php/conf.d/php-phpmyadmin.ini # Copy main script COPY docker-entrypoint.sh /docker-entrypoint.sh diff --git a/fpm/php.ini b/fpm/php.ini deleted file mode 100644 index 3dad93a..0000000 --- a/fpm/php.ini +++ /dev/null @@ -1,20 +0,0 @@ -[PHP] -allow_url_fopen = Off -max_execution_time = 600 -memory_limit = 512M -open_basedir = /var/www/html:/tmp/:/etc/phpmyadmin/ -post_max_size = 512M -upload_max_filesize = 512M - -[Session] -session.cookie_httponly = 1 -session.hash_function = 1 -session.save_path = "/sessions" -session.use_strict_mode = 1 - -[opcache] -opcache.fast_shutdown = 1 -opcache.restrict_api = /disabled/ -opcache.save_comments = 0 -opcache.use_cwd = 0 -opcache.validate_timestamps = 0 diff --git a/php.ini b/php.ini deleted file mode 100644 index 3dad93a..0000000 --- a/php.ini +++ /dev/null @@ -1,20 +0,0 @@ -[PHP] -allow_url_fopen = Off -max_execution_time = 600 -memory_limit = 512M -open_basedir = /var/www/html:/tmp/:/etc/phpmyadmin/ -post_max_size = 512M -upload_max_filesize = 512M - -[Session] -session.cookie_httponly = 1 -session.hash_function = 1 -session.save_path = "/sessions" -session.use_strict_mode = 1 - -[opcache] -opcache.fast_shutdown = 1 -opcache.restrict_api = /disabled/ -opcache.save_comments = 0 -opcache.use_cwd = 0 -opcache.validate_timestamps = 0 diff --git a/update.sh b/update.sh index 13d33d1..00443d0 100755 --- a/update.sh +++ b/update.sh @@ -28,7 +28,6 @@ for variant in apache fpm fpm-alpine; do cp $template "$variant/Dockerfile" cp config.inc.php "$variant/config.inc.php" cp docker-entrypoint.sh "$variant/docker-entrypoint.sh" - cp php.ini "$variant/php.ini" sed -ri -e ' s/%%VERSION%%/'"$latest"'/; s/%%VARIANT%%/'"$variant"'/;