From fe449cdb1bcb8f838dc1ed6d726dbc202cc6658a Mon Sep 17 00:00:00 2001 From: The Oh Brothers Bot Date: Wed, 20 Nov 2024 01:13:34 +0000 Subject: [PATCH] Enhancement: Add php 8.4.0 variants Signed-off-by: The Oh Brothers Bot --- .github/workflows/ci-master-pr.yml | 258 +++++++++++++++++- README.md | 5 +- generate/definitions/versions.json | 1 + .../Dockerfile | 76 ++++++ .../Dockerfile | 56 ++++ variants/8.4.0-fpm-alpine/Dockerfile | 6 + 6 files changed, 400 insertions(+), 2 deletions(-) create mode 100644 variants/8.4.0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets-xdebug/Dockerfile create mode 100644 variants/8.4.0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets/Dockerfile create mode 100644 variants/8.4.0-fpm-alpine/Dockerfile diff --git a/.github/workflows/ci-master-pr.yml b/.github/workflows/ci-master-pr.yml index f06ac62..a337114 100644 --- a/.github/workflows/ci-master-pr.yml +++ b/.github/workflows/ci-master-pr.yml @@ -33,6 +33,260 @@ jobs: run: | git diff --exit-code + build-8-4-0: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Display system info (linux) + run: | + set -e + hostname + whoami + cat /etc/*release + lscpu + free + df -h + pwd + docker info + docker version + + # See: https://github.com/docker/build-push-action/blob/v2.6.1/docs/advanced/cache.md#github-cache + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v3 + + - name: Cache Docker layers + uses: actions/cache@v4 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-8.4.0-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx-8.4.0- + ${{ runner.os }}-buildx- + + - name: Login to Docker Hub registry + # Run on master and tags + if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_REGISTRY_USER }} + password: ${{ secrets.DOCKERHUB_REGISTRY_PASSWORD }} + + # This step generates the docker tags + - name: Prepare + id: prep-8-4-0-fpm-alpine + run: | + set -e + + # Get ref, i.e. from refs/heads/, or from refs/tags/. E.g. 'master' or 'v0.0.0' + REF=$( echo "${GITHUB_REF}" | rev | cut -d '/' -f 1 | rev ) + + # Get short commit hash E.g. 'abc0123' + SHA=$( echo "${GITHUB_SHA}" | cut -c1-7 ) + + # Generate docker image tags + # E.g. 'v0.0.0-' and 'v0.0.0-abc0123-' + # E.g. 'master-' and 'master-abc0123-' + VARIANT="8.4.0-fpm-alpine" + REF_VARIANT="${REF}-${VARIANT}" + REF_SHA_VARIANT="${REF}-${SHA}-${VARIANT}" + + # Pass variables to next step + echo "VARIANT_BUILD_DIR=$VARIANT_BUILD_DIR" >> $GITHUB_OUTPUT + echo "VARIANT=$VARIANT" >> $GITHUB_OUTPUT + echo "REF_VARIANT=$REF_VARIANT" >> $GITHUB_OUTPUT + echo "REF_SHA_VARIANT=$REF_SHA_VARIANT" >> $GITHUB_OUTPUT + + - name: 8.4.0-fpm-alpine - Build (PRs) + # Run only on pull requests + if: github.event_name == 'pull_request' + uses: docker/build-push-action@v5 + with: + context: variants/8.4.0-fpm-alpine + platforms: + push: false + tags: | + ${{ github.repository }}:${{ steps.prep-8-4-0-fpm-alpine.outputs.REF_VARIANT }} + ${{ github.repository }}:${{ steps.prep-8-4-0-fpm-alpine.outputs.REF_SHA_VARIANT }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + + - name: 8.4.0-fpm-alpine - Build and push (master) + # Run only on master + if: github.ref == 'refs/heads/master' + uses: docker/build-push-action@v5 + with: + context: variants/8.4.0-fpm-alpine + platforms: + push: true + tags: | + ${{ github.repository }}:${{ steps.prep-8-4-0-fpm-alpine.outputs.REF_VARIANT }} + ${{ github.repository }}:${{ steps.prep-8-4-0-fpm-alpine.outputs.REF_SHA_VARIANT }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + + - name: 8.4.0-fpm-alpine - Build and push (release) + if: startsWith(github.ref, 'refs/tags/') + uses: docker/build-push-action@v5 + with: + context: variants/8.4.0-fpm-alpine + platforms: + push: true + tags: | + ${{ github.repository }}:${{ steps.prep-8-4-0-fpm-alpine.outputs.VARIANT }} + ${{ github.repository }}:${{ steps.prep-8-4-0-fpm-alpine.outputs.REF_VARIANT }} + ${{ github.repository }}:${{ steps.prep-8-4-0-fpm-alpine.outputs.REF_SHA_VARIANT }} + ${{ github.repository }}:latest + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + + # This step generates the docker tags + - name: Prepare + id: prep-8-4-0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets + run: | + set -e + + # Get ref, i.e. from refs/heads/, or from refs/tags/. E.g. 'master' or 'v0.0.0' + REF=$( echo "${GITHUB_REF}" | rev | cut -d '/' -f 1 | rev ) + + # Get short commit hash E.g. 'abc0123' + SHA=$( echo "${GITHUB_SHA}" | cut -c1-7 ) + + # Generate docker image tags + # E.g. 'v0.0.0-' and 'v0.0.0-abc0123-' + # E.g. 'master-' and 'master-abc0123-' + VARIANT="8.4.0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets" + REF_VARIANT="${REF}-${VARIANT}" + REF_SHA_VARIANT="${REF}-${SHA}-${VARIANT}" + + # Pass variables to next step + echo "VARIANT_BUILD_DIR=$VARIANT_BUILD_DIR" >> $GITHUB_OUTPUT + echo "VARIANT=$VARIANT" >> $GITHUB_OUTPUT + echo "REF_VARIANT=$REF_VARIANT" >> $GITHUB_OUTPUT + echo "REF_SHA_VARIANT=$REF_SHA_VARIANT" >> $GITHUB_OUTPUT + + - name: 8.4.0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets - Build (PRs) + # Run only on pull requests + if: github.event_name == 'pull_request' + uses: docker/build-push-action@v5 + with: + context: variants/8.4.0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets + platforms: + push: false + tags: | + ${{ github.repository }}:${{ steps.prep-8-4-0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets.outputs.REF_VARIANT }} + ${{ github.repository }}:${{ steps.prep-8-4-0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets.outputs.REF_SHA_VARIANT }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + + - name: 8.4.0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets - Build and push (master) + # Run only on master + if: github.ref == 'refs/heads/master' + uses: docker/build-push-action@v5 + with: + context: variants/8.4.0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets + platforms: + push: true + tags: | + ${{ github.repository }}:${{ steps.prep-8-4-0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets.outputs.REF_VARIANT }} + ${{ github.repository }}:${{ steps.prep-8-4-0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets.outputs.REF_SHA_VARIANT }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + + - name: 8.4.0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets - Build and push (release) + if: startsWith(github.ref, 'refs/tags/') + uses: docker/build-push-action@v5 + with: + context: variants/8.4.0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets + platforms: + push: true + tags: | + ${{ github.repository }}:${{ steps.prep-8-4-0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets.outputs.VARIANT }} + ${{ github.repository }}:${{ steps.prep-8-4-0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets.outputs.REF_VARIANT }} + ${{ github.repository }}:${{ steps.prep-8-4-0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets.outputs.REF_SHA_VARIANT }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + + # This step generates the docker tags + - name: Prepare + id: prep-8-4-0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets-xdebug + run: | + set -e + + # Get ref, i.e. from refs/heads/, or from refs/tags/. E.g. 'master' or 'v0.0.0' + REF=$( echo "${GITHUB_REF}" | rev | cut -d '/' -f 1 | rev ) + + # Get short commit hash E.g. 'abc0123' + SHA=$( echo "${GITHUB_SHA}" | cut -c1-7 ) + + # Generate docker image tags + # E.g. 'v0.0.0-' and 'v0.0.0-abc0123-' + # E.g. 'master-' and 'master-abc0123-' + VARIANT="8.4.0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets-xdebug" + REF_VARIANT="${REF}-${VARIANT}" + REF_SHA_VARIANT="${REF}-${SHA}-${VARIANT}" + + # Pass variables to next step + echo "VARIANT_BUILD_DIR=$VARIANT_BUILD_DIR" >> $GITHUB_OUTPUT + echo "VARIANT=$VARIANT" >> $GITHUB_OUTPUT + echo "REF_VARIANT=$REF_VARIANT" >> $GITHUB_OUTPUT + echo "REF_SHA_VARIANT=$REF_SHA_VARIANT" >> $GITHUB_OUTPUT + + - name: 8.4.0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets-xdebug - Build (PRs) + # Run only on pull requests + if: github.event_name == 'pull_request' + uses: docker/build-push-action@v5 + with: + context: variants/8.4.0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets-xdebug + platforms: + push: false + tags: | + ${{ github.repository }}:${{ steps.prep-8-4-0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets-xdebug.outputs.REF_VARIANT }} + ${{ github.repository }}:${{ steps.prep-8-4-0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets-xdebug.outputs.REF_SHA_VARIANT }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + + - name: 8.4.0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets-xdebug - Build and push (master) + # Run only on master + if: github.ref == 'refs/heads/master' + uses: docker/build-push-action@v5 + with: + context: variants/8.4.0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets-xdebug + platforms: + push: true + tags: | + ${{ github.repository }}:${{ steps.prep-8-4-0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets-xdebug.outputs.REF_VARIANT }} + ${{ github.repository }}:${{ steps.prep-8-4-0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets-xdebug.outputs.REF_SHA_VARIANT }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + + - name: 8.4.0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets-xdebug - Build and push (release) + if: startsWith(github.ref, 'refs/tags/') + uses: docker/build-push-action@v5 + with: + context: variants/8.4.0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets-xdebug + platforms: + push: true + tags: | + ${{ github.repository }}:${{ steps.prep-8-4-0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets-xdebug.outputs.VARIANT }} + ${{ github.repository }}:${{ steps.prep-8-4-0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets-xdebug.outputs.REF_VARIANT }} + ${{ github.repository }}:${{ steps.prep-8-4-0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets-xdebug.outputs.REF_SHA_VARIANT }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + + # Temp fix + # https://github.com/docker/build-push-action/issues/252 + # https://github.com/moby/buildkit/issues/1896 + - name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache + build-8-3-13: runs-on: ubuntu-latest steps: @@ -141,7 +395,6 @@ jobs: ${{ github.repository }}:${{ steps.prep-8-3-13-fpm-alpine.outputs.VARIANT }} ${{ github.repository }}:${{ steps.prep-8-3-13-fpm-alpine.outputs.REF_VARIANT }} ${{ github.repository }}:${{ steps.prep-8-3-13-fpm-alpine.outputs.REF_SHA_VARIANT }} - ${{ github.repository }}:latest cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max @@ -1807,6 +2060,7 @@ jobs: update-draft-release: needs: + - build-8-4-0 - build-8-3-13 - build-8-2-25 - build-8-1-30 @@ -1827,6 +2081,7 @@ jobs: publish-draft-release: needs: + - build-8-4-0 - build-8-3-13 - build-8-2-25 - build-8-1-30 @@ -1849,6 +2104,7 @@ jobs: update-dockerhub-description: needs: + - build-8-4-0 - build-8-3-13 - build-8-2-25 - build-8-1-30 diff --git a/README.md b/README.md index 8e3ff2c..2ff1766 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,10 @@ Dockerized php with php extension(s), based on [official php images](https://hub | Tag | Dockerfile Build Context | |:-------:|:---------:| -| `:8.3.13-fpm-alpine`, `:latest` | [View](variants/8.3.13-fpm-alpine) | +| `:8.4.0-fpm-alpine`, `:latest` | [View](variants/8.4.0-fpm-alpine) | +| `:8.4.0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets` | [View](variants/8.4.0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets) | +| `:8.4.0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets-xdebug` | [View](variants/8.4.0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets-xdebug) | +| `:8.3.13-fpm-alpine` | [View](variants/8.3.13-fpm-alpine) | | `:8.3.13-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets` | [View](variants/8.3.13-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets) | | `:8.3.13-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets-xdebug` | [View](variants/8.3.13-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets-xdebug) | | `:8.2.25-fpm-alpine` | [View](variants/8.2.25-fpm-alpine) | diff --git a/generate/definitions/versions.json b/generate/definitions/versions.json index b9c2364..baafa64 100644 --- a/generate/definitions/versions.json +++ b/generate/definitions/versions.json @@ -1,6 +1,7 @@ { "php": { "versions": [ + "8.4.0", "8.3.13", "8.2.25", "8.1.30", diff --git a/variants/8.4.0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets-xdebug/Dockerfile b/variants/8.4.0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets-xdebug/Dockerfile new file mode 100644 index 0000000..eed27f3 --- /dev/null +++ b/variants/8.4.0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets-xdebug/Dockerfile @@ -0,0 +1,76 @@ +FROM php:8.4.0-fpm-alpine + +# opcache +RUN set -eux; \ + docker-php-ext-install opcache + +# mysqli (deprecated) +RUN set -eux; \ + docker-php-ext-install mysqli + +# gd +RUN set -eux; \ + apk add --no-cache freetype libjpeg-turbo libpng; \ + apk add --no-cache --virtual .deps freetype-dev libjpeg-turbo-dev libpng-dev; \ + docker-php-ext-configure gd \ + --with-freetype=/usr/include/ \ + --with-jpeg=/usr/include/; \ + docker-php-ext-install gd; \ + docker-php-source delete; \ + apk del .deps + +# PDO: mysql driver +RUN set -eux; \ + docker-php-ext-install pdo pdo_mysql + +# PDO: pgsql driver +# See: https://github.com/docker-library/php/issues/221 +RUN set -eux; \ + apk add --no-cache postgresql-libs; \ + apk add --no-cache --virtual .deps postgresql-dev; \ + docker-php-ext-install pdo_pgsql; \ + apk del .deps + +# memcached +# See: https://stackoverflow.com/questions/40894385/how-can-i-install-the-php-memcached-extension-on-dockers-php7-alpine-image +RUN set -eux; \ + apk add --no-cache libmemcached-libs zlib; \ + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS; \ + apk add --no-cache --virtual .deps zlib-dev libmemcached-dev cyrus-sasl-dev; \ + pecl install memcached; \ + echo "extension=memcached.so" > /usr/local/etc/php/conf.d/20_memcached.ini; \ + docker-php-source delete; \ + apk del .deps; \ + apk del .phpize-deps; + +# Sockets +# See: https://github.com/docker-library/php/issues/181#issuecomment-173365852 +RUN set -eux; \ + apk add --no-cache --virtual .deps linux-headers; \ + docker-php-ext-install sockets; \ + apk del .deps + +# Xdebug: https://stackoverflow.com/questions/46825502/how-do-i-install-xdebug-on-dockers-official-php-fpm-alpine-image +# PHPIZE_DEPS: autoconf dpkg-dev dpkg file g++ gcc libc-dev make pkgconf re2c +RUN set -eux; \ + apk add --no-cache --virtual .build-dependencies $PHPIZE_DEPS; \ + apk add --no-cache --virtual .deps linux-headers; \ + pecl install xdebug-3.3.1; \ + docker-php-ext-enable xdebug; \ + docker-php-source delete; \ + apk del .deps; \ + apk del .build-dependencies +RUN set -eux; \ + { \ + echo "[xdebug]"; \ + echo "zend_extension=xdebug"; \ + echo "xdebug.mode=debug"; \ + echo "xdebug.start_with_request=yes"; \ + echo "xdebug.client_host=host.docker.internal"; \ + echo "xdebug.client_port=9000"; \ + } > /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; + +RUN set -eux; \ + echo; \ + php -i; \ + php -m diff --git a/variants/8.4.0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets/Dockerfile b/variants/8.4.0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets/Dockerfile new file mode 100644 index 0000000..c56558f --- /dev/null +++ b/variants/8.4.0-fpm-alpine-opcache-mysqli-gd-pdo-memcached-sockets/Dockerfile @@ -0,0 +1,56 @@ +FROM php:8.4.0-fpm-alpine + +# opcache +RUN set -eux; \ + docker-php-ext-install opcache + +# mysqli (deprecated) +RUN set -eux; \ + docker-php-ext-install mysqli + +# gd +RUN set -eux; \ + apk add --no-cache freetype libjpeg-turbo libpng; \ + apk add --no-cache --virtual .deps freetype-dev libjpeg-turbo-dev libpng-dev; \ + docker-php-ext-configure gd \ + --with-freetype=/usr/include/ \ + --with-jpeg=/usr/include/; \ + docker-php-ext-install gd; \ + docker-php-source delete; \ + apk del .deps + +# PDO: mysql driver +RUN set -eux; \ + docker-php-ext-install pdo pdo_mysql + +# PDO: pgsql driver +# See: https://github.com/docker-library/php/issues/221 +RUN set -eux; \ + apk add --no-cache postgresql-libs; \ + apk add --no-cache --virtual .deps postgresql-dev; \ + docker-php-ext-install pdo_pgsql; \ + apk del .deps + +# memcached +# See: https://stackoverflow.com/questions/40894385/how-can-i-install-the-php-memcached-extension-on-dockers-php7-alpine-image +RUN set -eux; \ + apk add --no-cache libmemcached-libs zlib; \ + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS; \ + apk add --no-cache --virtual .deps zlib-dev libmemcached-dev cyrus-sasl-dev; \ + pecl install memcached; \ + echo "extension=memcached.so" > /usr/local/etc/php/conf.d/20_memcached.ini; \ + docker-php-source delete; \ + apk del .deps; \ + apk del .phpize-deps; + +# Sockets +# See: https://github.com/docker-library/php/issues/181#issuecomment-173365852 +RUN set -eux; \ + apk add --no-cache --virtual .deps linux-headers; \ + docker-php-ext-install sockets; \ + apk del .deps + +RUN set -eux; \ + echo; \ + php -i; \ + php -m diff --git a/variants/8.4.0-fpm-alpine/Dockerfile b/variants/8.4.0-fpm-alpine/Dockerfile new file mode 100644 index 0000000..4a8afea --- /dev/null +++ b/variants/8.4.0-fpm-alpine/Dockerfile @@ -0,0 +1,6 @@ +FROM php:8.4.0-fpm-alpine + +RUN set -eux; \ + echo; \ + php -i; \ + php -m