diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 7970c8f..d7cda44 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -127,6 +127,60 @@ jobs: cache-from: type=gha, scope=${{ github.workflow }}-php cache-to: type=gha, scope=${{ github.workflow }}-php, mode=max + build-docker-dev-image: + name: 'Build php-${{ matrix.image.version }}-dev docker image' + runs-on: ubuntu-latest + + strategy: + fail-fast: false + max-parallel: 10 + matrix: + image: + - version: 7.2 + build-args: | + PHP_VERSION=7.2 + UBUNTU_VERSION=18.04 + XDEBUG_VERSION=3.1.6 + - version: 7.4 + build-args: | + PHP_VERSION=7.4 + UBUNTU_VERSION=20.04 + XDEBUG_VERSION=3.1.6 + - version: 8.1 + build-args: | + PHP_VERSION=8.1 + UBUNTU_VERSION=22.04 + XDEBUG_VERSION=3.3.2 + - version: 8.2 + file: 8.2.dockerfile + build-args: | + PHP_VERSION=8.2 + UBUNTU_VERSION=24.04 + XDEBUG_VERSION=3.3.2 + - version: 8.3 + build-args: | + PHP_VERSION=8.3 + UBUNTU_VERSION=24.04 + XDEBUG_VERSION=3.3.2 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup QEMU + uses: docker/setup-qemu-action@v3 + + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GHCR + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push (php-fpm-dev) uses: docker/build-push-action@v6 with: diff --git a/php/8.2.dockerfile b/php/8.2.dockerfile index 40ab4c4..8d3fe99 100644 --- a/php/8.2.dockerfile +++ b/php/8.2.dockerfile @@ -31,30 +31,18 @@ RUN apt-get update && \ apt-transport-https\ libfcgi-bin \ ca-certificates \ - curl \ + wget \ gnupg2 \ 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 echo 'deb https://packages.tideways.com/apt-packages-main any-version main' > /etc/apt/sources.list.d/tideways.list && \ - curl -L -sS 'https://packages.tideways.com/key.gpg' | apt-key add - +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 && \ + wget -qO - '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 \ @@ -62,6 +50,7 @@ RUN apt-get update && \ openssl \ optipng \ pngquant \ + supervisor \ tar \ unzip \ webp \ @@ -69,8 +58,8 @@ RUN apt-get update && \ php${PHP_VERSION} \ php${PHP_VERSION}-apcu \ php${PHP_VERSION}-bcmath \ - php${PHP_VERSION}-common \ php${PHP_VERSION}-cli \ + php${PHP_VERSION}-common \ php${PHP_VERSION}-curl \ php${PHP_VERSION}-fpm \ php${PHP_VERSION}-gd \ @@ -83,15 +72,30 @@ RUN apt-get update && \ php${PHP_VERSION}-pgsql \ php${PHP_VERSION}-readline \ php${PHP_VERSION}-redis \ + php${PHP_VERSION}-sqlite3 \ php${PHP_VERSION}-xml \ php${PHP_VERSION}-yaml \ php${PHP_VERSION}-zip \ - && apt-get -y install --no-install-suggests --no-install-recommends \ 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 /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 @@ -101,12 +105,18 @@ RUN mkdir -p "/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 @@ -136,16 +146,6 @@ CMD ["php", "-a"] FROM php-cli AS php-cron -RUN apt-get update && \ - apt-get -y install --no-install-suggests --no-install-recommends \ - cron \ - && 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.*/* - -WORKDIR /var/www - COPY cron/docker-cron-entrypoint /usr/local/bin/ ENTRYPOINT ["docker-cron-entrypoint"] @@ -153,19 +153,6 @@ CMD ["cron", "-f", "-l", "2"] FROM php-cli AS php-supervisor -RUN apt-get update && \ - apt-get -y install --no-install-suggests --no-install-recommends \ - supervisor \ - && 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.*/* - -RUN touch /var/run/supervisord.pid \ - && chown www-data:www-data /var/run/supervisord.pid - -WORKDIR /var/www - COPY supervisor/docker-supervisor-entrypoint /usr/local/bin/ COPY supervisor/supervisord.conf /etc/supervisor/supervisord.conf @@ -188,7 +175,7 @@ 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${PHP_VERSION}-sqlite3 php-pear openssh-client git patch \ + 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} \ @@ -210,7 +197,6 @@ RUN apt-get update && \ COPY --from=composer:2 /usr/bin/composer /usr/bin/composer COPY dev/scripts /usr/local/bin/ -COPY dev/bash /root/ # Dev PHP cli FROM php-fpm-dev AS php-cli-dev @@ -228,14 +214,6 @@ CMD ["php", "-a"] # Dev PHP cron FROM php-cli-dev AS php-cron-dev -RUN apt-get update && \ - apt-get -y install --no-install-suggests --no-install-recommends \ - cron \ - && 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.*/* - WORKDIR /var/www COPY cron/docker-cron-entrypoint /usr/local/bin/ diff --git a/php/Dockerfile b/php/Dockerfile index 6e0b44c..e893379 100644 --- a/php/Dockerfile +++ b/php/Dockerfile @@ -29,28 +29,16 @@ RUN apt-get update && \ apt-get -y install --no-install-suggests --no-install-recommends \ libfcgi-bin \ ca-certificates \ - curl \ + wget \ gnupg2 \ 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 echo 'deb https://packages.tideways.com/apt-packages-main any-version main' > /etc/apt/sources.list.d/tideways.list && \ - curl -L -sS 'https://packages.tideways.com/key.gpg' | apt-key add - +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 && \ + wget -qO - 'https://packages.tideways.com/key.gpg' | gpg --dearmor | tee /usr/share/keyrings/tideways.gpg > /dev/null RUN apt-get update && \ apt-get -y install --no-install-suggests --no-install-recommends \ + cron \ ghostscript \ gifsicle \ imagemagick \ @@ -58,6 +46,7 @@ RUN apt-get update && \ openssl \ optipng \ pngquant \ + supervisor \ tar \ unzip \ webp \ @@ -65,8 +54,8 @@ RUN apt-get update && \ php${PHP_VERSION} \ php${PHP_VERSION}-apcu \ php${PHP_VERSION}-bcmath \ - php${PHP_VERSION}-common \ php${PHP_VERSION}-cli \ + php${PHP_VERSION}-common \ php${PHP_VERSION}-curl \ php${PHP_VERSION}-fpm \ php${PHP_VERSION}-gd \ @@ -79,15 +68,30 @@ RUN apt-get update && \ php${PHP_VERSION}-pgsql \ php${PHP_VERSION}-readline \ php${PHP_VERSION}-redis \ + php${PHP_VERSION}-sqlite3 \ php${PHP_VERSION}-xml \ php${PHP_VERSION}-yaml \ php${PHP_VERSION}-zip \ - && apt-get -y install --no-install-suggests --no-install-recommends \ 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 /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 @@ -97,12 +101,18 @@ RUN mkdir -p "/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 @@ -132,16 +142,6 @@ CMD ["php", "-a"] FROM php-cli AS php-cron -RUN apt-get update && \ - apt-get -y install --no-install-suggests --no-install-recommends \ - cron \ - && 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.*/* - -WORKDIR /var/www - COPY cron/docker-cron-entrypoint /usr/local/bin/ ENTRYPOINT ["docker-cron-entrypoint"] @@ -149,19 +149,6 @@ CMD ["cron", "-f", "-l", "2"] FROM php-cli AS php-supervisor -RUN apt-get update && \ - apt-get -y install --no-install-suggests --no-install-recommends \ - supervisor \ - && 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.*/* - -RUN touch /var/run/supervisord.pid \ - && chown www-data:www-data /var/run/supervisord.pid - -WORKDIR /var/www - COPY supervisor/docker-supervisor-entrypoint /usr/local/bin/ COPY supervisor/supervisord.conf /etc/supervisor/supervisord.conf @@ -184,7 +171,7 @@ 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${PHP_VERSION}-sqlite3 php-pear openssh-client git patch \ + 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} \ @@ -206,7 +193,6 @@ RUN apt-get update && \ COPY --from=composer:2 /usr/bin/composer /usr/bin/composer COPY dev/scripts /usr/local/bin/ -COPY dev/bash /root/ # Dev PHP cli FROM php-fpm-dev AS php-cli-dev @@ -224,14 +210,6 @@ CMD ["php", "-a"] # Dev PHP cron FROM php-cli-dev AS php-cron-dev -RUN apt-get update && \ - apt-get -y install --no-install-suggests --no-install-recommends \ - cron \ - && 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.*/* - WORKDIR /var/www COPY cron/docker-cron-entrypoint /usr/local/bin/