diff --git a/quick/_settings.sh.example b/quick/_settings.sh.example index 3b9c025..ddefea3 100644 --- a/quick/_settings.sh.example +++ b/quick/_settings.sh.example @@ -1 +1 @@ -PHP_VERSIONS=(74 81 82 83) \ No newline at end of file +PHP_VERSIONS=(81 82 83 84 85) \ No newline at end of file diff --git a/src/docker-compose.yml b/src/docker-compose.yml index d058a48..508aca9 100755 --- a/src/docker-compose.yml +++ b/src/docker-compose.yml @@ -65,3 +65,9 @@ services: service: workspace build: dockerfile: workspace/workspace84.Dockerfile + workspace85: + extends: + file: docker-compose.base.yml + service: workspace + build: + dockerfile: workspace/workspace85.Dockerfile diff --git a/src/dockerfiles/php/fpm/php.base.Dockerfile b/src/dockerfiles/php/fpm/php.base.Dockerfile index cc90279..cfd127c 100644 --- a/src/dockerfiles/php/fpm/php.base.Dockerfile +++ b/src/dockerfiles/php/fpm/php.base.Dockerfile @@ -33,16 +33,25 @@ RUN locale-gen en_US.UTF-8 # Install PHP-extensions: ########################################################################### -RUN docker-php-ext-install -j$(nproc) iconv +# iconv and pdo are compiled statically into the official images (7.4 - 8.5), +# so there is nothing to install/enable for them RUN docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp && \ docker-php-ext-install -j$(nproc) gd -# opcache already installed and only need enable to -RUN docker-php-ext-enable opcache +# opcache: +# - PHP 7.4: shared module (opcache.so), but not enabled in the official image +# - PHP 8.0-8.4: shared module (opcache.so), already enabled in the official image +# - PHP 8.5+: compiled statically into the PHP binary (no opcache.so at all) +# That is why it is enabled only when it is really missing +RUN if php -m | grep -q "^Zend OPcache$"; then \ + echo "Opcache is already built into PHP: $(php -r 'echo PHP_VERSION;')"; \ + else \ + docker-php-ext-enable opcache; \ + fi # some extension already loaded by default (of course if or after is installed) -ARG EXTENSIONS='pdo intl mysqli pgsql zip bcmath bz2 pdo_mysql pdo_pgsql' +ARG EXTENSIONS='intl mysqli pgsql zip bcmath bz2 pdo_mysql pdo_pgsql' # Extension automatic enable in helper install script # See: https://github.com/devilbox/docker-php-fpm-7.4/blob/master/data/docker-php-ext-install#L111 @@ -55,12 +64,22 @@ RUN docker-php-ext-install ${EXTENSIONS} # For PHP 7.4 xdebug 3.1 also is supported, but staty xdebug 2 version for compatibility experiences # See https://xdebug.org/docs/compat # And see exactly xdebug minor versions: https://pecl.php.net/package/xdebug +# Xdebug is bound to a PHP version range, so the version is picked by the PHP minor version: +# 3.5.x -> PHP 8.5 +# 3.4.x -> PHP 8.0 - 8.4 +# 2.9.x -> PHP 7.x +ARG XDEBUG_VERSION_PHP8_5=3.5.3 +ARG XDEBUG_VERSION_PHP8=3.4.1 +ARG XDEBUG_VERSION_PHP7=2.9.8 + RUN PHP_MAJOR_VERSION=$(php -r 'echo PHP_MAJOR_VERSION;') && \ PHP_MINOR_VERSION=$(php -r 'echo PHP_MINOR_VERSION;') && \ - if [ $PHP_MAJOR_VERSION = '8' ]; then \ - pecl install xdebug-3.4.1; \ - elif [ $PHP_MAJOR_VERSION = '7' ]; then \ - pecl install xdebug-2.9.8; \ + if [ "$PHP_MAJOR_VERSION" = '8' ] && [ "$PHP_MINOR_VERSION" -ge 5 ]; then \ + pecl install xdebug-${XDEBUG_VERSION_PHP8_5}; \ + elif [ "$PHP_MAJOR_VERSION" = '8' ]; then \ + pecl install xdebug-${XDEBUG_VERSION_PHP8}; \ + elif [ "$PHP_MAJOR_VERSION" = '7' ]; then \ + pecl install xdebug-${XDEBUG_VERSION_PHP7}; \ else \ echo "Not support that major PHP version: $PHP_MAJOR_VERSION"; \ exit 1; \ @@ -97,7 +116,7 @@ ARG PHP_OPT_MEMORY_LIMIT=256M RUN sed -i "s/^memory_limit = .*/memory_limit = $PHP_OPT_MEMORY_LIMIT/g" "$PHP_INI_DIR/php.ini" ARG PHP_OPT_POST_MAX_SIZE=300M -RUN sed -i "s/^post_max_size = .*/post_max_size = $PHP_OPT_UPLOAD_MAX_FILESIZE/g" "$PHP_INI_DIR/php.ini" +RUN sed -i "s/^post_max_size = .*/post_max_size = $PHP_OPT_POST_MAX_SIZE/g" "$PHP_INI_DIR/php.ini" ARG PHP_OPT_UPLOAD_MAX_FILESIZE=100M RUN sed -i "s/^upload_max_filesize = .*/upload_max_filesize = $PHP_OPT_UPLOAD_MAX_FILESIZE/g" "$PHP_INI_DIR/php.ini" @@ -112,6 +131,6 @@ RUN sed -i "s/^max_execution_time = .*/max_execution_time = $PHP_OPT_MAX_EXECUTI # # Clean up -RUN apt clean && \ +RUN apt-get clean && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ - rm /var/log/lastlog /var/log/faillog + rm -f /var/log/lastlog /var/log/faillog diff --git a/src/dockerfiles/php/workspace/workspace.base.Dockerfile b/src/dockerfiles/php/workspace/workspace.base.Dockerfile index 1ba32da..0396c9c 100644 --- a/src/dockerfiles/php/workspace/workspace.base.Dockerfile +++ b/src/dockerfiles/php/workspace/workspace.base.Dockerfile @@ -33,12 +33,22 @@ SHELL ["/bin/sh", "-c"] # xDebug: ########################################################################### +# Xdebug is bound to a PHP version range, so the version is picked by the PHP minor version: +# 3.5.x -> PHP 8.5 +# 3.4.x -> PHP 8.0 - 8.4 +# 2.9.x -> PHP 7.x +ARG XDEBUG_VERSION_PHP8_5=3.5.3 +ARG XDEBUG_VERSION_PHP8=3.4.1 +ARG XDEBUG_VERSION_PHP7=2.9.8 + RUN PHP_MAJOR_VERSION=$(php -r 'echo PHP_MAJOR_VERSION;') && \ PHP_MINOR_VERSION=$(php -r 'echo PHP_MINOR_VERSION;') && \ - if [ $PHP_MAJOR_VERSION = '8' ]; then \ - pecl install xdebug-3.4.1; \ - elif [ $PHP_MAJOR_VERSION = '7' ]; then \ - pecl install xdebug-2.9.8; \ + if [ "$PHP_MAJOR_VERSION" = '8' ] && [ "$PHP_MINOR_VERSION" -ge 5 ]; then \ + pecl install xdebug-${XDEBUG_VERSION_PHP8_5}; \ + elif [ "$PHP_MAJOR_VERSION" = '8' ]; then \ + pecl install xdebug-${XDEBUG_VERSION_PHP8}; \ + elif [ "$PHP_MAJOR_VERSION" = '7' ]; then \ + pecl install xdebug-${XDEBUG_VERSION_PHP7}; \ else \ echo "Not support that major PHP version: $PHP_MAJOR_VERSION"; \ exit 1; \ diff --git a/src/quick/build-php.sh b/src/quick/build-php.sh index 289d993..97d32c4 100644 --- a/src/quick/build-php.sh +++ b/src/quick/build-php.sh @@ -3,7 +3,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "$SCRIPT_DIR/.." -PHP_VERSIONS=(74 81 82 83) +PHP_VERSIONS=(81 82 83 84 85) set -e