From 70fe494a0283f45f5394ed278c70a545ec07da17 Mon Sep 17 00:00:00 2001 From: Sascha Nowak Date: Fri, 29 Nov 2024 15:56:32 +0100 Subject: [PATCH 1/3] feat: Add php 8.4 --- .github/workflows/php.yml | 16 +- build-container.sh | 8 + php/8.4.Dockerfile | 233 ++++++++++++++++++++++++++ php/config/fpm-8.4/pool.d/.gitkeep | 0 php/config/fpm-8.4/pool.d/access.conf | 3 + 5 files changed, 258 insertions(+), 2 deletions(-) create mode 100644 php/8.4.Dockerfile create mode 100644 php/config/fpm-8.4/pool.d/.gitkeep create mode 100644 php/config/fpm-8.4/pool.d/access.conf diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index ed370af..fa0ce08 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -55,7 +55,13 @@ jobs: build-args: | PHP_VERSION=8.3 UBUNTU_VERSION=24.04 - XDEBUG_VERSION=3.3.2 + XDEBUG_VERSION=3.4.0 + - version: 8.4 + file: 8.4.Dockerfile + build-args: | + PHP_VERSION=8.4 + UBUNTU_VERSION=24.04 + XDEBUG_VERSION=3.4.0 steps: - name: Checkout @@ -165,7 +171,13 @@ jobs: build-args: | PHP_VERSION=8.3 UBUNTU_VERSION=24.04 - XDEBUG_VERSION=3.3.2 + XDEBUG_VERSION=3.4.0 + - version: 8.4 + file: 8.4.Dockerfile + build-args: | + PHP_VERSION=8.4 + UBUNTU_VERSION=24.04 + XDEBUG_VERSION=3.4.0 steps: - name: Checkout diff --git a/build-container.sh b/build-container.sh index df0d911..d13db19 100755 --- a/build-container.sh +++ b/build-container.sh @@ -77,5 +77,13 @@ docker buildx build -t ghcr.io/netlogix/docker/php-cron:8.3 --build-arg PHP_VERS docker buildx build -t ghcr.io/netlogix/docker/php-cron-dev:8.3 --build-arg PHP_VERSION=8.3 --build-arg UBUNTU_VERSION=24.04 -f php/Dockerfile --target=php-cron-dev php docker buildx build -t ghcr.io/netlogix/docker/php-supervisor:8.3 --build-arg PHP_VERSION=8.3 --build-arg UBUNTU_VERSION=24.04 -f php/Dockerfile --target=php-supervisor php +docker buildx build -t ghcr.io/netlogix/docker/php-fpm:8.4 --build-arg PHP_VERSION=8.4 --build-arg UBUNTU_VERSION=24.04 -f php/8.4.Dockerfile --target=php-fpm php +docker buildx build -t ghcr.io/netlogix/docker/php-cli:8.4 --build-arg PHP_VERSION=8.4 --build-arg UBUNTU_VERSION=24.04 -f php/8.4.Dockerfile --target=php-cli php +docker buildx build -t ghcr.io/netlogix/docker/php-fpm-dev:8.4 --build-arg PHP_VERSION=8.4 --build-arg UBUNTU_VERSION=24.04 -f php/8.4.Dockerfile --target=php-fpm-dev php +docker buildx build -t ghcr.io/netlogix/docker/php-cli-dev:8.4 --build-arg PHP_VERSION=8.4 --build-arg UBUNTU_VERSION=24.04 -f php/8.4.Dockerfile --target=php-cli-dev php +docker buildx build -t ghcr.io/netlogix/docker/php-cron:8.4 --build-arg PHP_VERSION=8.4 --build-arg UBUNTU_VERSION=24.04 -f php/8.4.Dockerfile --target=php-cron php +docker buildx build -t ghcr.io/netlogix/docker/php-cron-dev:8.4 --build-arg PHP_VERSION=8.4 --build-arg UBUNTU_VERSION=24.04 -f php/8.4.Dockerfile --target=php-cron-dev php +docker buildx build -t ghcr.io/netlogix/docker/php-supervisor:8.4 --build-arg PHP_VERSION=8.4 --build-arg UBUNTU_VERSION=24.04 -f php/8.4.Dockerfile --target=php-supervisor php + docker buildx build -t ghcr.io/netlogix/docker/node:18 --build-arg NODE_VERSION=18 -f node/Dockerfile node docker buildx build -t ghcr.io/netlogix/docker/node:20 --build-arg NODE_VERSION=20 -f node/Dockerfile node diff --git a/php/8.4.Dockerfile b/php/8.4.Dockerfile new file mode 100644 index 0000000..3b9fd4a --- /dev/null +++ b/php/8.4.Dockerfile @@ -0,0 +1,233 @@ +# syntax=docker/dockerfile:1 +ARG UBUNTU_VERSION=24.04 +FROM ubuntu:${UBUNTU_VERSION} AS base +ARG PHP_VERSION=8.4 +ARG XDEBUG_VERSION=3.4.0 + +ENV DEBIAN_FRONTEND=noninteractive \ + TZ=UTC \ + LANG="C.UTF-8" + +ENV PHP_VERSION=${PHP_VERSION} \ + PHP_MEMORY_LIMIT=128m \ + PHP_MAX_EXECUTION_TIME=30 \ + PHP_MAX_INPUT_VARS=1500 \ + PHP_ASSERT=-1 \ + PHP_POST_MAX_SIZE=100M \ + PHP_UPLOAD_MAX_FILESIZE=100M \ + PHP_OPCACHE_ENABLE_FILE_OVERRIDE=0 \ + PHP_OPCACHE_INTERNED_STRINGS_BUFFER=8 \ + PHP_OPCACHE_PRELOAD_USER=www-data \ + PHP_REALPATH_CACHE_TTL=512 \ + PHP_XDEBUG_HOST=host.docker.internal \ + PHP_XDEBUG_MODE=off \ + XDEBUG_VERSION=${XDEBUG_VERSION} \ + TIDEWAYS_APIKEY="" \ + TIDEWAYS_DAEMON="tcp://tideways-daemon:9135" \ + TIDEWAYS_SAMPLERATE=25 + +RUN apt-get update && \ + apt-get -y install --no-install-suggests --no-install-recommends \ + software-properties-common \ + apt-transport-https\ + libfcgi-bin \ + ca-certificates \ + curl \ + gnupg2 \ + locales + +RUN echo 'deb [signed-by=/usr/share/keyrings/tideways.gpg] https://packages.tideways.com/apt-packages-main any-version main' | tee /etc/apt/sources.list.d/tideways.list && \ + curl -L -sS 'https://packages.tideways.com/key.gpg' | gpg --dearmor | tee /usr/share/keyrings/tideways.gpg > /dev/null + +RUN add-apt-repository ppa:ondrej/php -y + +RUN apt-get update && \ + apt-get -y install --no-install-suggests --no-install-recommends \ + cron \ + ghostscript \ + gifsicle \ + imagemagick \ + jpegoptim \ + nano \ + openssl \ + optipng \ + pngquant \ + supervisor \ + tar \ + unzip \ + webp \ + zip \ + php${PHP_VERSION} \ + php${PHP_VERSION}-apcu \ + php${PHP_VERSION}-bcmath \ + php${PHP_VERSION}-cli \ + php${PHP_VERSION}-common \ + php${PHP_VERSION}-curl \ + php${PHP_VERSION}-fpm \ + php${PHP_VERSION}-gd \ + php${PHP_VERSION}-igbinary \ + php${PHP_VERSION}-imagick \ + php${PHP_VERSION}-intl \ + php${PHP_VERSION}-mbstring \ + php${PHP_VERSION}-mysql \ + php${PHP_VERSION}-opcache \ + php${PHP_VERSION}-pgsql \ + php${PHP_VERSION}-readline \ + php${PHP_VERSION}-redis \ + php${PHP_VERSION}-soap \ + php${PHP_VERSION}-sqlite3 \ + php${PHP_VERSION}-xml \ + php${PHP_VERSION}-yaml \ + php${PHP_VERSION}-zip \ + tideways-php \ + tideways-cli \ + && apt-get autoremove \ + && find /var/log -type f -name "*.log" -delete \ + && rm -rf /var/lib/apt/lists/* /var/cache/ldconfig/aux-cache \ + && rm -rf /etc/cron.*/* + +# Install locales +RUN locale-gen de_DE.UTF-8 && \ + locale-gen en_GB.UTF-8 && \ + locale-gen en_US.UTF-8 && \ + locale-gen es_ES.UTF-8 && \ + locale-gen fr_FR.UTF-8 && \ + locale-gen nl_NL.UTF-8 && \ + locale-gen pt_PT.UTF-8 && \ + locale-gen it_IT.UTF-8 + +# Install dev certificates +COPY certs/* /usr/share/ca-certificates/netlogix/ +RUN echo "netlogix/docker-dev-ca.crt" >> /etc/ca-certificates.conf && update-ca-certificates + +RUN ln -s /usr/sbin/php-fpm${PHP_VERSION} /usr/sbin/php-fpm + +RUN mkdir -p "/run/php/" \ + && chown -R www-data:www-data /run/php/ \ + && chmod 755 /run/php/ \ + && touch /var/log/xdebug.log \ + && chown www-data:www-data /var/log/xdebug.log + +RUN touch /var/run/supervisord.pid \ + && chown www-data:www-data /var/run/supervisord.pid + +# Config files +COPY config/conf.d /etc/php/${PHP_VERSION}/cli/conf.d/ +COPY config/conf.d /etc/php/${PHP_VERSION}/fpm/conf.d/ +COPY config/fpm/pool.d /etc/php/${PHP_VERSION}/fpm/pool.d/ +COPY config/fpm-${PHP_VERSION}/pool.d /etc/php/${PHP_VERSION}/fpm/pool.d/ + +# Config files +COPY dev/bash /root/ + +# Test php-fpm config and php info +RUN php-fpm -tt +RUN php -i + +WORKDIR /var/www + +FROM base AS php-fpm + +COPY fpm /usr/local/bin/ + +STOPSIGNAL SIGQUIT +EXPOSE 9000 + +HEALTHCHECK --interval=2s --timeout=5s --retries=10 CMD php-fpm-healthcheck || exit 1 +ENTRYPOINT ["docker-php-entrypoint"] +CMD ["php-fpm"] + +FROM base AS php-cli + +STOPSIGNAL SIGTERM + +ENV PHP_MEMORY_LIMIT=-1 \ + PHP_MAX_EXECUTION_TIME=-1 + +COPY cli/docker-php-entrypoint /usr/local/bin/ + +ENTRYPOINT ["docker-php-entrypoint"] +CMD ["php", "-a"] + +FROM php-cli AS php-cron + +WORKDIR /var/www + +COPY --chmod=0755 cron/docker-cron-entrypoint /usr/local/bin/ + +ENTRYPOINT ["docker-cron-entrypoint"] +CMD ["cron", "-f", "-l", "2"] + +FROM php-cli AS php-supervisor + +COPY supervisor/docker-supervisor-entrypoint /usr/local/bin/ +COPY supervisor/supervisord.conf /etc/supervisor/supervisord.conf + +USER www-data + +ENTRYPOINT ["docker-supervisor-entrypoint"] +CMD ["supervisord", "-n", "-c", "/etc/supervisor/supervisord.conf"] + +# Dev PHP fpm +FROM php-fpm AS php-fpm-dev + +ENV PHP_ASSERT=1 \ + COMPOSER_CACHE_DIR=/.cache/composer/ \ + YARN_CACHE_FOLDER=/.cache/yarn/ \ + npm_config_cache=/.cache/npm/ \ + TERM=xterm-256color + +# enable debugging with PhpStorm +ENV PHP_IDE_CONFIG="serverName=localhost" + +RUN apt-get update && \ + apt-get -y install --no-install-suggests --no-install-recommends \ + make php${PHP_VERSION}-dev php-pear openssh-client git patch \ + && mkdir -p /tmp/pear/cache \ + && pecl channel-update pecl.php.net \ + && pecl install xdebug-${XDEBUG_VERSION} \ + && echo "zend_extension=xdebug.so" > /etc/php/${PHP_VERSION}/mods-available/xdebug.ini \ + && phpenmod xdebug \ + && apt-get -y autoremove --purge make php${PHP_VERSION}-dev php-pear \ + && apt-get autoremove \ + && find /var/log -type f -name "*.log" -delete \ + && rm -rf /root/.pearrc \ + && rm -rf /tmp/pear \ + && rm -rf /var/lib/php/modules/${PHP_VERSION}/cli/disabled_by_maint \ + && rm -rf /var/lib/php/modules/${PHP_VERSION}/fpm/disabled_by_maint \ + && rm -rf /usr/share/php/.registry /usr/share/php/.depdb /usr/share/php/.filemap \ + && rm -rf /usr/share/bug/file \ + && rm -rf /usr/share/doc/file \ + && rm -rf /var/lib/apt/lists/* /var/cache/ldconfig/aux-cache \ + && touch /var/log/xdebug.log \ + && chown www-data:www-data /var/log/xdebug.log + +COPY --from=composer:2 /usr/bin/composer /usr/bin/composer +COPY dev/scripts /usr/local/bin/ + +# Dev PHP cli +FROM php-fpm-dev AS php-cli-dev + +STOPSIGNAL SIGTERM + +ENV PHP_MEMORY_LIMIT=-1 +ENV PHP_MAX_EXECUTION_TIME=-1 + +COPY cli/docker-php-entrypoint /usr/local/bin/ + +# Disabling the health check of the descendant php-fpm-dev image, since the production php-cron image does neither have a healthcheck. +HEALTHCHECK NONE +ENTRYPOINT ["docker-php-entrypoint"] +CMD ["php", "-a"] + +# Dev PHP cron +FROM php-cli-dev AS php-cron-dev + +WORKDIR /var/www + +COPY --chmod=0755 cron/docker-cron-entrypoint /usr/local/bin/ + +# Disabling the health check of the descendant php-fpm-dev image, since the production php-cron image does neither have a healthcheck. +HEALTHCHECK NONE +ENTRYPOINT ["docker-cron-entrypoint"] +CMD ["cron", "-f", "-l", "2"] diff --git a/php/config/fpm-8.4/pool.d/.gitkeep b/php/config/fpm-8.4/pool.d/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/php/config/fpm-8.4/pool.d/access.conf b/php/config/fpm-8.4/pool.d/access.conf new file mode 100644 index 0000000..dabb62e --- /dev/null +++ b/php/config/fpm-8.4/pool.d/access.conf @@ -0,0 +1,3 @@ +[www] +access.suppress_path[] = /health +access.suppress_path[] = /status From fda6b503b3de16345ce70ab49359018e4acb9138 Mon Sep 17 00:00:00 2001 From: Sascha Nowak Date: Fri, 29 Nov 2024 16:06:49 +0100 Subject: [PATCH 2/3] feat: Update php xdebug to version 3.4.0 --- .github/workflows/php.yml | 8 ++++---- php/8.2.Dockerfile | 2 +- php/Dockerfile | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index fa0ce08..8e6b3d2 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -44,13 +44,13 @@ jobs: build-args: | PHP_VERSION=8.1 UBUNTU_VERSION=22.04 - XDEBUG_VERSION=3.3.2 + XDEBUG_VERSION=3.4.0 - version: 8.2 file: 8.2.Dockerfile build-args: | PHP_VERSION=8.2 UBUNTU_VERSION=24.04 - XDEBUG_VERSION=3.3.2 + XDEBUG_VERSION=3.4.0 - version: 8.3 build-args: | PHP_VERSION=8.3 @@ -160,13 +160,13 @@ jobs: build-args: | PHP_VERSION=8.1 UBUNTU_VERSION=22.04 - XDEBUG_VERSION=3.3.2 + XDEBUG_VERSION=3.4.0 - version: 8.2 file: 8.2.Dockerfile build-args: | PHP_VERSION=8.2 UBUNTU_VERSION=24.04 - XDEBUG_VERSION=3.3.2 + XDEBUG_VERSION=3.4.0 - version: 8.3 build-args: | PHP_VERSION=8.3 diff --git a/php/8.2.Dockerfile b/php/8.2.Dockerfile index 3461f1c..b5cf07f 100644 --- a/php/8.2.Dockerfile +++ b/php/8.2.Dockerfile @@ -2,7 +2,7 @@ ARG UBUNTU_VERSION=24.04 FROM ubuntu:${UBUNTU_VERSION} AS base ARG PHP_VERSION=8.2 -ARG XDEBUG_VERSION=3.3.2 +ARG XDEBUG_VERSION=3.4.0 ENV DEBIAN_FRONTEND=noninteractive \ TZ=UTC \ diff --git a/php/Dockerfile b/php/Dockerfile index a5bfedf..90c8fd7 100644 --- a/php/Dockerfile +++ b/php/Dockerfile @@ -2,7 +2,7 @@ ARG UBUNTU_VERSION=24.04 FROM ubuntu:${UBUNTU_VERSION} AS base ARG PHP_VERSION=8.3 -ARG XDEBUG_VERSION=3.3.2 +ARG XDEBUG_VERSION=3.4.0 ENV DEBIAN_FRONTEND=noninteractive \ TZ=UTC \ From 8c26ef81e83806df96cf3554dfea273160904053 Mon Sep 17 00:00:00 2001 From: Sascha Nowak Date: Fri, 29 Nov 2024 16:29:17 +0100 Subject: [PATCH 3/3] fix: align dockerfiles --- php/8.2.Dockerfile | 7 ++++--- php/8.4.Dockerfile | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/php/8.2.Dockerfile b/php/8.2.Dockerfile index b5cf07f..6568d90 100644 --- a/php/8.2.Dockerfile +++ b/php/8.2.Dockerfile @@ -29,7 +29,7 @@ ENV PHP_VERSION=${PHP_VERSION} \ RUN apt-get update && \ apt-get -y install --no-install-suggests --no-install-recommends \ software-properties-common \ - apt-transport-https\ + apt-transport-https \ libfcgi-bin \ ca-certificates \ curl \ @@ -131,7 +131,7 @@ FROM base AS php-fpm COPY fpm /usr/local/bin/ -STOPSIGNAL SIGQUIT +STOPSIGNAL SIGTERM EXPOSE 9000 HEALTHCHECK --interval=2s --timeout=5s --retries=10 CMD php-fpm-healthcheck || exit 1 @@ -176,7 +176,8 @@ ENV PHP_ASSERT=1 \ COMPOSER_CACHE_DIR=/.cache/composer/ \ YARN_CACHE_FOLDER=/.cache/yarn/ \ npm_config_cache=/.cache/npm/ \ - TERM=xterm-256color + TERM=xterm-256color \ + TIDEWAYS_DAEMON="" # enable debugging with PhpStorm ENV PHP_IDE_CONFIG="serverName=localhost" diff --git a/php/8.4.Dockerfile b/php/8.4.Dockerfile index 3b9fd4a..55415a8 100644 --- a/php/8.4.Dockerfile +++ b/php/8.4.Dockerfile @@ -29,7 +29,7 @@ ENV PHP_VERSION=${PHP_VERSION} \ RUN apt-get update && \ apt-get -y install --no-install-suggests --no-install-recommends \ software-properties-common \ - apt-transport-https\ + apt-transport-https \ libfcgi-bin \ ca-certificates \ curl \ @@ -130,7 +130,7 @@ FROM base AS php-fpm COPY fpm /usr/local/bin/ -STOPSIGNAL SIGQUIT +STOPSIGNAL SIGTERM EXPOSE 9000 HEALTHCHECK --interval=2s --timeout=5s --retries=10 CMD php-fpm-healthcheck || exit 1 @@ -175,7 +175,8 @@ ENV PHP_ASSERT=1 \ COMPOSER_CACHE_DIR=/.cache/composer/ \ YARN_CACHE_FOLDER=/.cache/yarn/ \ npm_config_cache=/.cache/npm/ \ - TERM=xterm-256color + TERM=xterm-256color \ + TIDEWAYS_DAEMON="" # enable debugging with PhpStorm ENV PHP_IDE_CONFIG="serverName=localhost"