From 2dfc2a8ae003105b16d5b71b1878074ed2c12463 Mon Sep 17 00:00:00 2001 From: Francis Hilaire Date: Sat, 29 Mar 2025 18:14:44 +0100 Subject: [PATCH 01/43] Add FrankenPHP build --- .github/workflows/sylius-frankenphp.yml | 246 ++++++++++++++++++ frankenphp/BUILD | 16 ++ frankenphp/Caddyfile | 63 +++++ frankenphp/Dockerfile | 105 ++++++++ frankenphp/conf.d/app-cli.ini | 16 ++ frankenphp/conf.d/app.ini | 15 ++ frankenphp/conf.d/app.prod.ini | 2 + frankenphp/docker-entrypoint.sh | 40 +++ frankenphp/fixuid.Dockerfile | 30 +++ .../testdata/frankenphp1.5-php8.0_amd64.yaml | 120 +++++++++ .../testdata/frankenphp1.5-php8.0_arm64.yaml | 120 +++++++++ .../testdata/frankenphp1.5-php8.1_amd64.yaml | 120 +++++++++ .../testdata/frankenphp1.5-php8.1_arm64.yaml | 120 +++++++++ .../testdata/frankenphp1.5-php8.2_amd64.yaml | 118 +++++++++ .../testdata/frankenphp1.5-php8.2_arm64.yaml | 118 +++++++++ .../testdata/frankenphp1.5-php8.3_amd64.yaml | 118 +++++++++ .../testdata/frankenphp1.5-php8.3_arm64.yaml | 118 +++++++++ .../testdata/frankenphp1.5-php8.4_amd64.yaml | 118 +++++++++ .../testdata/frankenphp1.5-php8.4_arm64.yaml | 118 +++++++++ frankenphp/worker.Caddyfile | 4 + frankenphp/xdebug.Dockerfile | 24 ++ 21 files changed, 1749 insertions(+) create mode 100644 .github/workflows/sylius-frankenphp.yml create mode 100644 frankenphp/BUILD create mode 100644 frankenphp/Caddyfile create mode 100644 frankenphp/Dockerfile create mode 100644 frankenphp/conf.d/app-cli.ini create mode 100644 frankenphp/conf.d/app.ini create mode 100644 frankenphp/conf.d/app.prod.ini create mode 100644 frankenphp/docker-entrypoint.sh create mode 100644 frankenphp/fixuid.Dockerfile create mode 100644 frankenphp/testdata/frankenphp1.5-php8.0_amd64.yaml create mode 100644 frankenphp/testdata/frankenphp1.5-php8.0_arm64.yaml create mode 100644 frankenphp/testdata/frankenphp1.5-php8.1_amd64.yaml create mode 100644 frankenphp/testdata/frankenphp1.5-php8.1_arm64.yaml create mode 100644 frankenphp/testdata/frankenphp1.5-php8.2_amd64.yaml create mode 100644 frankenphp/testdata/frankenphp1.5-php8.2_arm64.yaml create mode 100644 frankenphp/testdata/frankenphp1.5-php8.3_amd64.yaml create mode 100644 frankenphp/testdata/frankenphp1.5-php8.3_arm64.yaml create mode 100644 frankenphp/testdata/frankenphp1.5-php8.4_amd64.yaml create mode 100644 frankenphp/testdata/frankenphp1.5-php8.4_arm64.yaml create mode 100644 frankenphp/worker.Caddyfile create mode 100644 frankenphp/xdebug.Dockerfile diff --git a/.github/workflows/sylius-frankenphp.yml b/.github/workflows/sylius-frankenphp.yml new file mode 100644 index 0000000..3770eed --- /dev/null +++ b/.github/workflows/sylius-frankenphp.yml @@ -0,0 +1,246 @@ +name: PHP Docker Image CI for Sylius + +on: + workflow_dispatch: + push: + branches: [ frankenphp ] + paths: + - 'frankenphp/**' + - 'WORKSPACE' + schedule: + - cron: '0 20 * * 5' + +concurrency: + group: sylius_frankenphp_build + cancel-in-progress: false + +jobs: + + build: + + name: "Sylius FrankenPHP - ${{ matrix.frankenphp }}${{ matrix.php }}${{ matrix.distro }}" + + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + frankenphp: [ "1.5-php" ] + php: [ "8.0", "8.1", "8.2", "8.3", "8.4" ] + distro: [ "", "-alpine" ] + + steps: + + - uses: actions/checkout@v4 + + - name: Generate UUID + id: generate-uuid + run: | + UUID=$(cat /proc/sys/kernel/random/uuid) + echo "UUID=${UUID}" >> $GITHUB_OUTPUT + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ vars.DOCKER_FRANKENPHP_REPOSITORY_NAME }} + tags: | + type=raw,value=${{ matrix.frankenphp }}${{ matrix.php }}${{ matrix.distro }} + labels: | + org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }} + org.opencontainers.image.description=Sylius FrankenPHP ${{ matrix.frankenphp }}${{ matrix.php }} Docker image + org.opencontainers.image.licenses=MIT + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Cache Docker layers + uses: actions/cache@v4 + with: + path: /tmp/.buildx-cache + key: "${{ runner.os }}-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}${{ matrix.distro }}-buildx-cache-${{ vars.CACHE_VERSION }}-${{ steps.generate-uuid.outputs.uuid }}" + # https://github.com/actions/cache/issues/109#issuecomment-558771281 + # https://github.community/t/always-save-new-cache-for-incremental-builds/172791 + restore-keys: "${{ runner.os }}-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}${{ matrix.distro }}-buildx-cache-${{ vars.CACHE_VERSION }}-" + + - name: Docker Login + uses: docker/login-action@v3 + with: + registry: ${{ secrets.DOCKER_REGISTRY }} + username: ${{ secrets.DOCKER_REPOSITORY_LOGIN }} + password: ${{ secrets.DOCKER_REPOSITORY_PASSWORD }} + logout: true + + - name: Build multiplatform + uses: docker/build-push-action@v5 + with: + file: ./frankenphp/Dockerfile + context: ./frankenphp + build-args: "FRANKENPHP_VERSION=${{ matrix.frankenphp }}${{ matrix.php }}" + platforms: linux/amd64,linux/arm64 + push: false + pull: true + tags: ${{ steps.meta.outputs.tags }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new + + - name: Build linux/amd64 to tar + uses: docker/build-push-action@v5 + with: + file: ./frankenphp/Dockerfile + context: ./frankenphp + build-args: "FRANKENPHP_VERSION=${{ matrix.frankenphp }}${{ matrix.php }}" + platforms: linux/amd64 + push: false + pull: false + tags: ${{ steps.meta.outputs.tags }} + cache-from: type=local,src=/tmp/.buildx-cache-new + cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new-amd64 + outputs: type=docker,dest=./external/image-amd64.tar + + - name: Build linux/arm64 to tar + uses: docker/build-push-action@v5 + with: + file: ./frankenphp/Dockerfile + context: ./frankenphp + build-args: "FRANKENPHP_VERSION=${{ matrix.frankenphp }}${{ matrix.php }}" + platforms: linux/arm64 + push: false + pull: false + tags: ${{ steps.meta.outputs.tags }} + cache-from: type=local,src=/tmp/.buildx-cache-new + cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new-arm64 + outputs: type=docker,dest=./external/image-arm64.tar + + - name: Mount Bazel cache + uses: actions/cache@v4 + with: + path: "~/.cache/bazel" + key: "${{ runner.os }}-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-bazel-cache-${{ vars.CACHE_VERSION }}-${{ steps.generate-uuid.outputs.uuid }}" + restore-keys: "${{ runner.os }}-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-bazel-cache-${{ vars.CACHE_VERSION }}-" + + - name: Setup PHP for Bazel + run: | + set -ex + cat > frankenphp/frankenphp-version.bzl < frankenphp/frankenphp-arch.bzl <> $GITHUB_OUTPUT + + - name: Set up QEMU + id: qemu + uses: docker/setup-qemu-action@v3 + + - name: Available platforms + run: echo ${{ steps.qemu.outputs.platforms }} + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ vars.DOCKER_FRANKENPHP_REPOSITORY_NAME }} + tags: | + type=raw,value=${{ matrix.frankenphp }}${{ matrix.php }}-xdebug${{ matrix.distro }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Cache Docker layers + uses: actions/cache@v4 + with: + path: /tmp/.buildx-cache + key: "${{ runner.os }}-frankenphp-xdebug-${{ matrix.frankenphp }}${{ matrix.php }}${{ matrix.distro }}-buildx-cache-${{ vars.CACHE_VERSION }}-${{ steps.generate-uuid.outputs.uuid }}" + # https://github.com/actions/cache/issues/109#issuecomment-558771281 + # https://github.community/t/always-save-new-cache-for-incremental-builds/172791 + restore-keys: "${{ runner.os }}-frankenphp-xdebug-${{ matrix.frankenphp }}${{ matrix.php }}${{ matrix.distro }}-buildx-cache-${{ vars.CACHE_VERSION }}-" + + - name: Docker Login + uses: docker/login-action@v3 + with: + registry: ${{ secrets.DOCKER_REGISTRY }} + username: ${{ secrets.DOCKER_REPOSITORY_LOGIN }} + password: ${{ secrets.DOCKER_REPOSITORY_PASSWORD }} + logout: true + + - name: Prepare variable names for Docker build + id: docker-build-variable-names + run: | + PHP_VERSION="${{ matrix.php }}" + PHP_XDEBUG_VERSION_VARIABLE=XDEBUG_VERSION_PHP_${PHP_VERSION//./_} + echo "XDEBUG_VERSION=$(jq -r --arg PHP_XDEBUG_VERSION_VARIABLE "$PHP_XDEBUG_VERSION_VARIABLE" '.[$PHP_XDEBUG_VERSION_VARIABLE]' <<< '${{ toJSON(vars) }}')" >> $GITHUB_ENV + + - name: Build and push + uses: docker/build-push-action@v5 + with: + file: ./frankenphp/xdebug.Dockerfile + context: ./frankenphp + build-args: | + "IMAGE_NAME=${{ vars.DOCKER_FRANKENPHP_REPOSITORY_NAME }}" + "IMAGE_TAG=${{ matrix.frankenphp }}${{ matrix.php }}${{ matrix.distro }}" + "XDEBUG_VERSION=${{ env.XDEBUG_VERSION }}" + platforms: linux/amd64,linux/arm64 + push: ${{ github.ref == 'refs/heads/main' || github.event_name == 'release' }} + pull: true + tags: ${{ steps.meta.outputs.tags }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new + + - name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache diff --git a/frankenphp/BUILD b/frankenphp/BUILD new file mode 100644 index 0000000..47e39bb --- /dev/null +++ b/frankenphp/BUILD @@ -0,0 +1,16 @@ +load("@io_bazel_rules_docker//container:import.bzl", "container_import") +load("@io_bazel_rules_docker//contrib:test.bzl", "container_test") +load(":php-arch.bzl", "ARCHITECTURES") +load(":php-version.bzl", "FRANKENPHP_VERSION") + +package(default_visibility = ["//visibility:public"]) + +[ + container_test( + name = "frankenphp" + FRANKENPHP_VERSION + "_" + arch + "_test", + size = "medium", + configs = ["testdata/frankenphp" + FRANKENPHP_VERSION + "_" + arch + ".yaml"], + image = "@image" + arch + "//image", + ) + for arch in ARCHITECTURES +] diff --git a/frankenphp/Caddyfile b/frankenphp/Caddyfile new file mode 100644 index 0000000..e420385 --- /dev/null +++ b/frankenphp/Caddyfile @@ -0,0 +1,63 @@ +{ + {$CADDY_GLOBAL_OPTIONS} + + frankenphp { + {$FRANKENPHP_CONFIG} + } +} + +{$CADDY_EXTRA_CONFIG} + +{$SERVER_NAME:localhost} { + log { + # Redact the authorization query parameter that can be set by Mercure + format filter { + request>uri query { + replace authorization REDACTED + } + } + } + + root * /app/public + encode zstd br gzip + + mercure { + # Transport to use (default to Bolt) + transport_url {$MERCURE_TRANSPORT_URL:bolt:///data/mercure.db} + # Publisher JWT key + publisher_jwt {env.MERCURE_PUBLISHER_JWT_KEY} {env.MERCURE_PUBLISHER_JWT_ALG} + # Subscriber JWT key + subscriber_jwt {env.MERCURE_SUBSCRIBER_JWT_KEY} {env.MERCURE_SUBSCRIBER_JWT_ALG} + # Allow anonymous subscribers (double-check that it's what you want) + anonymous + # Enable the subscription API (double-check that it's what you want) + subscriptions + # Extra directives + {$MERCURE_EXTRA_DIRECTIVES} + } + + vulcain + + # Add links to the API docs and to the Mercure Hub if not set explicitly (e.g. the PWA) + header ?Link `; rel="http://www.w3.org/ns/hydra/core#apiDocumentation", ; rel="mercure"` + # Disable Topics tracking if not enabled explicitly: https://github.com/jkarlin/topics + header ?Permissions-Policy "browsing-topics=()" + + # Matches requests for HTML documents, for static files and for Next.js files, + # except for known API paths and paths with extensions handled by API Platform + @pwa expression `( + header({'Accept': '*text/html*'}) + && !path( + '/docs*', '/graphql*', '/bundles*', '/contexts*', '/_profiler*', '/_wdt*', + '*.json*', '*.html', '*.csv', '*.yml', '*.yaml', '*.xml' + ) + ) + || path('/favicon.ico', '/manifest.json', '/robots.txt', '/sitemap*', '/_next*', '/__next*') + || query({'_rsc': '*'})` + + # Comment the following line if you don't want Next.js to catch requests for HTML documents. + # In this case, they will be handled by the PHP app. + reverse_proxy @pwa http://{$PWA_UPSTREAM} + + php_server +} diff --git a/frankenphp/Dockerfile b/frankenphp/Dockerfile new file mode 100644 index 0000000..9337819 --- /dev/null +++ b/frankenphp/Dockerfile @@ -0,0 +1,105 @@ +#syntax=docker/dockerfile:1 +ARG FRANKENPHP_VERSION=1.5-php8.2 + +# Adapted from https://github.com/dunglas/symfony-docker + +# Versions +FROM dunglas/frankenphp:${FRANKENPHP_VERSION} AS frankenphp_upstream + + +# The different stages of this Dockerfile are meant to be built into separate images +# https://docs.docker.com/develop/develop-images/multistage-build/#stop-at-a-specific-build-stage +# https://docs.docker.com/compose/compose-file/#target + + +# Base FrankenPHP image +FROM frankenphp_upstream AS frankenphp_base + +WORKDIR /srv/sylius + +# persistent / runtime deps +# hadolint ignore=DL3008 +RUN if [ "$(awk -F= '/^NAME/{print $2}' /etc/os-release)" = '"Ubuntu"' ]; then \ + apt-get update \ + && apt-get install --no-install-recommends -y \ + acl \ + file \ + gettext \ + git \ + && rm -rf /var/lib/apt/lists/*; \ +fi +RUN if [ "$(awk -F= '/^NAME/{print $2}' /etc/os-release)" = '"Alpine Linux"' ]; then \ + apk add --no-cache --virtual .build-deps $PHPIZE_DEPS linux-headers \ + && apk add --no-cache \ + acl \ + file \ + gettext \ + git \ + && apk del .build-deps; \ +fi + +# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser +ENV COMPOSER_ALLOW_SUPERUSER=1 + +RUN set -eux; \ + install-php-extensions \ + @composer \ + apcu \ + intl \ + opcache \ + zip \ + ; + +RUN set -eux; \ + install-php-extensions pdo_pgsql pdo_mysql pdo_sqlite + +COPY --link conf.d/app.ini $PHP_INI_DIR/conf.d/ +COPY --link --chmod=755 docker-entrypoint.sh /usr/local/bin/docker-entrypoint +COPY --link Caddyfile /etc/caddy/Caddyfile + +ENTRYPOINT ["docker-entrypoint"] + +HEALTHCHECK --start-period=60s CMD curl -f http://localhost:2019/metrics || exit 1 +CMD [ "frankenphp", "run", "--config", "/etc/caddy/Caddyfile" ] + +# Dev FrankenPHP image +FROM frankenphp_base AS frankenphp_dev + +ENV APP_ENV=dev XDEBUG_MODE=off +VOLUME /app/var/ + +RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" + +RUN set -eux; \ + install-php-extensions \ + xdebug \ + ; + +COPY --link conf.d/app.dev.ini $PHP_INI_DIR/conf.d/ +COPY --link conf.d/app-cli.ini $PHP_INI_DIR/conf.d/ + +CMD [ "frankenphp", "run", "--config", "/etc/caddy/Caddyfile", "--watch" ] + +# Prod FrankenPHP image +FROM frankenphp_base AS frankenphp_prod + +ENV APP_ENV=prod +ENV FRANKENPHP_CONFIG="import worker.Caddyfile" + +RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" + +COPY --link conf.d/app.prod.ini $PHP_INI_DIR/conf.d/ +COPY --link conf.d/app-cli.ini $PHP_INI_DIR/conf.d/ +COPY --link worker.Caddyfile /etc/caddy/worker.Caddyfile + +# prevent the reinstallation of vendors at every changes in the source code +COPY --link composer.* symfony.* ./ +RUN set -eux; \ + composer install --no-cache --prefer-dist --no-dev --no-autoloader --no-scripts --no-progress + +RUN set -eux; \ + mkdir -p var/cache var/log; \ + composer dump-autoload --classmap-authoritative --no-dev; \ + composer dump-env prod; \ + composer run-script --no-dev post-install-cmd; \ + chmod +x bin/console; sync; diff --git a/frankenphp/conf.d/app-cli.ini b/frankenphp/conf.d/app-cli.ini new file mode 100644 index 0000000..0e2579e --- /dev/null +++ b/frankenphp/conf.d/app-cli.ini @@ -0,0 +1,16 @@ +apc.enable_cli = 1 +date.timezone = ${PHP_DATE_TIMEZONE} +opcache.enable_cli = 1 +session.auto_start = Off +short_open_tag = Off + +# http://symfony.com/doc/current/performance.html +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 20000 +opcache.memory_consumption = 256 +realpath_cache_size = 4096K +realpath_cache_ttl = 600 + +memory_limit = 3G +post_max_size = 6M +upload_max_filesize = 5M diff --git a/frankenphp/conf.d/app.ini b/frankenphp/conf.d/app.ini new file mode 100644 index 0000000..dd08e3b --- /dev/null +++ b/frankenphp/conf.d/app.ini @@ -0,0 +1,15 @@ +apc.enable_cli = 1 +date.timezone = ${PHP_DATE_TIMEZONE} +opcache.enable_cli = 1 +session.auto_start = Off +short_open_tag = Off + +# http://symfony.com/doc/current/performance.html +opcache.interned_strings_buffer = 16 +opcache.max_accelerated_files = 20000 +opcache.memory_consumption = 256 +realpath_cache_size = 4096K +realpath_cache_ttl = 600 + +post_max_size = 6M +upload_max_filesize = 5M diff --git a/frankenphp/conf.d/app.prod.ini b/frankenphp/conf.d/app.prod.ini new file mode 100644 index 0000000..3bcaa71 --- /dev/null +++ b/frankenphp/conf.d/app.prod.ini @@ -0,0 +1,2 @@ +opcache.preload_user = root +opcache.preload = /app/config/preload.php diff --git a/frankenphp/docker-entrypoint.sh b/frankenphp/docker-entrypoint.sh new file mode 100644 index 0000000..cc779cd --- /dev/null +++ b/frankenphp/docker-entrypoint.sh @@ -0,0 +1,40 @@ +#!/bin/sh +set -e + +if [ "$1" = 'frankenphp' ] || [ "$1" = 'php' ] || [ "$1" = 'bin/console' ]; then + if [ -z "$(ls -A 'vendor/' 2>/dev/null)" ]; then + composer install --prefer-dist --no-progress --no-interaction + fi + + if grep -q ^DATABASE_URL= .env; then + echo "Waiting for database to be ready..." + ATTEMPTS_LEFT_TO_REACH_DATABASE=60 + until [ $ATTEMPTS_LEFT_TO_REACH_DATABASE -eq 0 ] || DATABASE_ERROR=$(php bin/console dbal:run-sql -q "SELECT 1" 2>&1); do + if [ $? -eq 255 ]; then + # If the Doctrine command exits with 255, an unrecoverable error occurred + ATTEMPTS_LEFT_TO_REACH_DATABASE=0 + break + fi + sleep 1 + ATTEMPTS_LEFT_TO_REACH_DATABASE=$((ATTEMPTS_LEFT_TO_REACH_DATABASE - 1)) + echo "Still waiting for database to be ready... Or maybe the database is not reachable. $ATTEMPTS_LEFT_TO_REACH_DATABASE attempts left." + done + + if [ $ATTEMPTS_LEFT_TO_REACH_DATABASE -eq 0 ]; then + echo "The database is not up or not reachable:" + echo "$DATABASE_ERROR" + exit 1 + else + echo "The database is now ready and reachable" + fi + + if [ "$( find ./migrations -iname '*.php' -print -quit )" ]; then + php bin/console doctrine:migrations:migrate --no-interaction --all-or-nothing + fi + fi + + setfacl -R -m u:www-data:rwX -m u:"$(whoami)":rwX var + setfacl -dR -m u:www-data:rwX -m u:"$(whoami)":rwX var +fi + +exec docker-php-entrypoint "$@" diff --git a/frankenphp/fixuid.Dockerfile b/frankenphp/fixuid.Dockerfile new file mode 100644 index 0000000..af50492 --- /dev/null +++ b/frankenphp/fixuid.Dockerfile @@ -0,0 +1,30 @@ +ARG IMAGE_NAME +ARG IMAGE_TAG +ARG FIXUID_VERSION=0.6.0 + +FROM ${IMAGE_NAME}:${IMAGE_TAG} + +ARG FIXUID_VERSION + +RUN addgroup -g 1000 sylius && \ + adduser -u 1000 -G sylius -h /home/sylius -s /bin/sh -D sylius + +RUN USER=sylius && \ + GROUP=sylius && \ + if [[ "$(uname -m)" = "aarch64" ]] ; \ + then \ + curl -SsL https://github.com/boxboat/fixuid/releases/download/v${FIXUID_VERSION}/fixuid-${FIXUID_VERSION}-linux-arm64.tar.gz | tar -C /usr/local/bin -xzf - ;\ + else \ + curl -SsL https://github.com/boxboat/fixuid/releases/download/v${FIXUID_VERSION}/fixuid-${FIXUID_VERSION}-linux-amd64.tar.gz | tar -C /usr/local/bin -xzf - ;\ + fi; \ + chown root:root /usr/local/bin/fixuid && \ + chmod 4755 /usr/local/bin/fixuid && \ + mkdir -p /etc/fixuid && \ + printf "user: $USER\ngroup: $GROUP\n" > /etc/fixuid/config.yml && \ + # Modify FrankenPHP entrypoint to use fixuid + sed -i 's/^set -e.*/set -e\nfixuid/g' /usr/local/bin/docker-php-entrypoint + +# Fix permissions during named volume creation +RUN mkdir -p /srv/sylius/public/media && chmod 777 -R /srv/sylius + +USER sylius:sylius \ No newline at end of file diff --git a/frankenphp/testdata/frankenphp1.5-php8.0_amd64.yaml b/frankenphp/testdata/frankenphp1.5-php8.0_amd64.yaml new file mode 100644 index 0000000..4c825e9 --- /dev/null +++ b/frankenphp/testdata/frankenphp1.5-php8.0_amd64.yaml @@ -0,0 +1,120 @@ +schemaVersion: "1.0.0" +fileExistenceTests: + - name: php-fpm executable + path: '/usr/local/sbin/php-fpm' + shouldExist: true + - name: php executable + path: '/usr/local/bin/php' + shouldExist: true + - name: 'Composer 755' + path: '/usr/bin/composer' + shouldExist: true + permissions: '-rwxr-xr-x' + - name: 'PHP Entry point 775' + path: '/usr/local/bin/docker-php-entrypoint' + shouldExist: true + permissions: '-rwxrwxr-x' +commandTests: + - name: arch + command: [ "uname", "-m" ] + expectedOutput: [ "x86_64" ] + - name: php-fpm version + command: [ "/usr/local/sbin/php-fpm", "--version" ] + expectedOutput: [ "PHP 8.0" ] + - name: php-fpm-modules + command: [ "/usr/local/sbin/php-fpm", "-m" ] + expectedOutput: + - 'apcu' + - 'cgi-fcgi' + - 'Core' + - 'ctype' + - 'curl' + - 'date' + - 'dom' + - 'exif' + - 'fileinfo' + - 'filter' + - 'ftp' + - 'gd' + - 'hash' + - 'iconv' + - 'intl' + - 'json' + - 'libxml' + - 'mbstring' + - 'mysqlnd' + - 'openssl' + - 'pcre' + - 'PDO' + - 'pdo_mysql' + - 'Phar' + - 'posix' + - 'readline' + - 'Reflection' + - 'session' + - 'SimpleXML' + - 'sodium' + - 'SPL' + - 'standard' + - 'tokenizer' + - 'xml' + - 'xmlreader' + - 'xmlwriter' + - 'Zend OPcache' + - 'zip' + - 'zlib' + - name: php-cli version + command: [ "/usr/local/bin/php", "--version" ] + expectedOutput: [ "PHP 8.0" ] + - name: config-files + command: [ "/usr/local/bin/php", "--ini" ] + expectedOutput: + - '/usr/local/etc/php/conf.d/docker-php-ext-apcu.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-exif.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-gd.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-intl.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-opcache.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-sodium.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-zip.ini' + - name: php-cli extensions + command: [ "/usr/local/bin/php", "-m" ] + expectedOutput: + - 'apcu' + - 'Core' + - 'ctype' + - 'curl' + - 'date' + - 'dom' + - 'exif' + - 'fileinfo' + - 'filter' + - 'ftp' + - 'gd' + - 'hash' + - 'iconv' + - 'intl' + - 'json' + - 'libxml' + - 'mbstring' + - 'mysqlnd' + - 'openssl' + - 'pcre' + - 'PDO' + - 'pdo_mysql' + - 'Phar' + - 'posix' + - 'readline' + - 'Reflection' + - 'session' + - 'SimpleXML' + - 'sodium' + - 'SPL' + - 'standard' + - 'tokenizer' + - 'xml' + - 'xmlreader' + - 'xmlwriter' + - 'Zend OPcache' + - 'zip' + - 'zlib' diff --git a/frankenphp/testdata/frankenphp1.5-php8.0_arm64.yaml b/frankenphp/testdata/frankenphp1.5-php8.0_arm64.yaml new file mode 100644 index 0000000..2727d53 --- /dev/null +++ b/frankenphp/testdata/frankenphp1.5-php8.0_arm64.yaml @@ -0,0 +1,120 @@ +schemaVersion: "1.0.0" +fileExistenceTests: + - name: php-fpm executable + path: '/usr/local/sbin/php-fpm' + shouldExist: true + - name: php executable + path: '/usr/local/bin/php' + shouldExist: true + - name: 'Composer 755' + path: '/usr/bin/composer' + shouldExist: true + permissions: '-rwxr-xr-x' + - name: 'PHP Entry point 775' + path: '/usr/local/bin/docker-php-entrypoint' + shouldExist: true + permissions: '-rwxrwxr-x' +commandTests: + - name: arch + command: [ "uname", "-m" ] + expectedOutput: [ "aarch64" ] + - name: php-fpm version + command: [ "/usr/local/sbin/php-fpm", "--version" ] + expectedOutput: [ "PHP 8.0" ] + - name: php-fpm-modules + command: [ "/usr/local/sbin/php-fpm", "-m" ] + expectedOutput: + - 'apcu' + - 'cgi-fcgi' + - 'Core' + - 'ctype' + - 'curl' + - 'date' + - 'dom' + - 'exif' + - 'fileinfo' + - 'filter' + - 'ftp' + - 'gd' + - 'hash' + - 'iconv' + - 'intl' + - 'json' + - 'libxml' + - 'mbstring' + - 'mysqlnd' + - 'openssl' + - 'pcre' + - 'PDO' + - 'pdo_mysql' + - 'Phar' + - 'posix' + - 'readline' + - 'Reflection' + - 'session' + - 'SimpleXML' + - 'sodium' + - 'SPL' + - 'standard' + - 'tokenizer' + - 'xml' + - 'xmlreader' + - 'xmlwriter' + - 'Zend OPcache' + - 'zip' + - 'zlib' + - name: php-cli version + command: [ "/usr/local/bin/php", "--version" ] + expectedOutput: [ "PHP 8.0" ] + - name: config-files + command: [ "/usr/local/bin/php", "--ini" ] + expectedOutput: + - '/usr/local/etc/php/conf.d/docker-php-ext-apcu.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-exif.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-gd.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-intl.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-opcache.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-sodium.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-zip.ini' + - name: php-cli extensions + command: [ "/usr/local/bin/php", "-m" ] + expectedOutput: + - 'apcu' + - 'Core' + - 'ctype' + - 'curl' + - 'date' + - 'dom' + - 'exif' + - 'fileinfo' + - 'filter' + - 'ftp' + - 'gd' + - 'hash' + - 'iconv' + - 'intl' + - 'json' + - 'libxml' + - 'mbstring' + - 'mysqlnd' + - 'openssl' + - 'pcre' + - 'PDO' + - 'pdo_mysql' + - 'Phar' + - 'posix' + - 'readline' + - 'Reflection' + - 'session' + - 'SimpleXML' + - 'sodium' + - 'SPL' + - 'standard' + - 'tokenizer' + - 'xml' + - 'xmlreader' + - 'xmlwriter' + - 'Zend OPcache' + - 'zip' + - 'zlib' diff --git a/frankenphp/testdata/frankenphp1.5-php8.1_amd64.yaml b/frankenphp/testdata/frankenphp1.5-php8.1_amd64.yaml new file mode 100644 index 0000000..9e3faeb --- /dev/null +++ b/frankenphp/testdata/frankenphp1.5-php8.1_amd64.yaml @@ -0,0 +1,120 @@ +schemaVersion: "1.0.0" +fileExistenceTests: + - name: php-fpm executable + path: '/usr/local/sbin/php-fpm' + shouldExist: true + - name: php executable + path: '/usr/local/bin/php' + shouldExist: true + - name: 'Composer 755' + path: '/usr/bin/composer' + shouldExist: true + permissions: '-rwxr-xr-x' + - name: 'PHP Entry point 755' + path: '/usr/local/bin/docker-php-entrypoint' + shouldExist: true + permissions: '-rwxr-xr-x' +commandTests: + - name: arch + command: [ "uname", "-m" ] + expectedOutput: [ "x86_64" ] + - name: php-fpm version + command: [ "/usr/local/sbin/php-fpm", "--version" ] + expectedOutput: [ "PHP 8.1" ] + - name: php-fpm-modules + command: [ "/usr/local/sbin/php-fpm", "-m" ] + expectedOutput: + - 'apcu' + - 'cgi-fcgi' + - 'Core' + - 'ctype' + - 'curl' + - 'date' + - 'dom' + - 'exif' + - 'fileinfo' + - 'filter' + - 'ftp' + - 'gd' + - 'hash' + - 'iconv' + - 'intl' + - 'json' + - 'libxml' + - 'mbstring' + - 'mysqlnd' + - 'openssl' + - 'pcre' + - 'PDO' + - 'pdo_mysql' + - 'Phar' + - 'posix' + - 'readline' + - 'Reflection' + - 'session' + - 'SimpleXML' + - 'sodium' + - 'SPL' + - 'standard' + - 'tokenizer' + - 'xml' + - 'xmlreader' + - 'xmlwriter' + - 'Zend OPcache' + - 'zip' + - 'zlib' + - name: php-cli version + command: [ "/usr/local/bin/php", "--version" ] + expectedOutput: [ "PHP 8.1" ] + - name: config-files + command: [ "/usr/local/bin/php", "--ini" ] + expectedOutput: + - '/usr/local/etc/php/conf.d/docker-php-ext-apcu.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-exif.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-gd.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-intl.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-opcache.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-sodium.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-zip.ini' + - name: php-cli extensions + command: [ "/usr/local/bin/php", "-m" ] + expectedOutput: + - 'apcu' + - 'Core' + - 'ctype' + - 'curl' + - 'date' + - 'dom' + - 'exif' + - 'fileinfo' + - 'filter' + - 'ftp' + - 'gd' + - 'hash' + - 'iconv' + - 'intl' + - 'json' + - 'libxml' + - 'mbstring' + - 'mysqlnd' + - 'openssl' + - 'pcre' + - 'PDO' + - 'pdo_mysql' + - 'Phar' + - 'posix' + - 'readline' + - 'Reflection' + - 'session' + - 'SimpleXML' + - 'sodium' + - 'SPL' + - 'standard' + - 'tokenizer' + - 'xml' + - 'xmlreader' + - 'xmlwriter' + - 'Zend OPcache' + - 'zip' + - 'zlib' diff --git a/frankenphp/testdata/frankenphp1.5-php8.1_arm64.yaml b/frankenphp/testdata/frankenphp1.5-php8.1_arm64.yaml new file mode 100644 index 0000000..99fda77 --- /dev/null +++ b/frankenphp/testdata/frankenphp1.5-php8.1_arm64.yaml @@ -0,0 +1,120 @@ +schemaVersion: "1.0.0" +fileExistenceTests: + - name: php-fpm executable + path: '/usr/local/sbin/php-fpm' + shouldExist: true + - name: php executable + path: '/usr/local/bin/php' + shouldExist: true + - name: 'Composer 755' + path: '/usr/bin/composer' + shouldExist: true + permissions: '-rwxr-xr-x' + - name: 'PHP Entry point 755' + path: '/usr/local/bin/docker-php-entrypoint' + shouldExist: true + permissions: '-rwxr-xr-x' +commandTests: + - name: arch + command: [ "uname", "-m" ] + expectedOutput: [ "aarch64" ] + - name: php-fpm version + command: [ "/usr/local/sbin/php-fpm", "--version" ] + expectedOutput: [ "PHP 8.1" ] + - name: php-fpm-modules + command: [ "/usr/local/sbin/php-fpm", "-m" ] + expectedOutput: + - 'apcu' + - 'cgi-fcgi' + - 'Core' + - 'ctype' + - 'curl' + - 'date' + - 'dom' + - 'exif' + - 'fileinfo' + - 'filter' + - 'ftp' + - 'gd' + - 'hash' + - 'iconv' + - 'intl' + - 'json' + - 'libxml' + - 'mbstring' + - 'mysqlnd' + - 'openssl' + - 'pcre' + - 'PDO' + - 'pdo_mysql' + - 'Phar' + - 'posix' + - 'readline' + - 'Reflection' + - 'session' + - 'SimpleXML' + - 'sodium' + - 'SPL' + - 'standard' + - 'tokenizer' + - 'xml' + - 'xmlreader' + - 'xmlwriter' + - 'Zend OPcache' + - 'zip' + - 'zlib' + - name: php-cli version + command: [ "/usr/local/bin/php", "--version" ] + expectedOutput: [ "PHP 8.1" ] + - name: config-files + command: [ "/usr/local/bin/php", "--ini" ] + expectedOutput: + - '/usr/local/etc/php/conf.d/docker-php-ext-apcu.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-exif.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-gd.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-intl.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-opcache.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-sodium.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-zip.ini' + - name: php-cli extensions + command: [ "/usr/local/bin/php", "-m" ] + expectedOutput: + - 'apcu' + - 'Core' + - 'ctype' + - 'curl' + - 'date' + - 'dom' + - 'exif' + - 'fileinfo' + - 'filter' + - 'ftp' + - 'gd' + - 'hash' + - 'iconv' + - 'intl' + - 'json' + - 'libxml' + - 'mbstring' + - 'mysqlnd' + - 'openssl' + - 'pcre' + - 'PDO' + - 'pdo_mysql' + - 'Phar' + - 'posix' + - 'readline' + - 'Reflection' + - 'session' + - 'SimpleXML' + - 'sodium' + - 'SPL' + - 'standard' + - 'tokenizer' + - 'xml' + - 'xmlreader' + - 'xmlwriter' + - 'Zend OPcache' + - 'zip' + - 'zlib' diff --git a/frankenphp/testdata/frankenphp1.5-php8.2_amd64.yaml b/frankenphp/testdata/frankenphp1.5-php8.2_amd64.yaml new file mode 100644 index 0000000..3e96462 --- /dev/null +++ b/frankenphp/testdata/frankenphp1.5-php8.2_amd64.yaml @@ -0,0 +1,118 @@ +schemaVersion: "1.0.0" +fileExistenceTests: + - name: php-fpm executable + path: '/usr/local/sbin/php-fpm' + shouldExist: true + - name: php executable + path: '/usr/local/bin/php' + shouldExist: true + - name: 'Composer 755' + path: '/usr/bin/composer' + shouldExist: true + permissions: '-rwxr-xr-x' + - name: 'PHP Entry point 755' + path: '/usr/local/bin/docker-php-entrypoint' + shouldExist: true + permissions: '-rwxr-xr-x' +commandTests: + - name: arch + command: [ "uname", "-m" ] + expectedOutput: [ "x86_64" ] + - name: php-fpm version + command: [ "/usr/local/sbin/php-fpm", "--version" ] + expectedOutput: [ "PHP 8.2" ] + - name: php-fpm-modules + command: [ "/usr/local/sbin/php-fpm", "-m" ] + expectedOutput: + - 'apcu' + - 'cgi-fcgi' + - 'Core' + - 'ctype' + - 'curl' + - 'date' + - 'dom' + - 'exif' + - 'fileinfo' + - 'filter' + - 'gd' + - 'hash' + - 'iconv' + - 'intl' + - 'json' + - 'libxml' + - 'mbstring' + - 'mysqlnd' + - 'openssl' + - 'pcre' + - 'PDO' + - 'pdo_mysql' + - 'Phar' + - 'posix' + - 'readline' + - 'Reflection' + - 'session' + - 'SimpleXML' + - 'sodium' + - 'SPL' + - 'standard' + - 'tokenizer' + - 'xml' + - 'xmlreader' + - 'xmlwriter' + - 'Zend OPcache' + - 'zip' + - 'zlib' + - name: php-cli version + command: [ "/usr/local/bin/php", "--version" ] + expectedOutput: [ "PHP 8.2" ] + - name: config-files + command: [ "/usr/local/bin/php", "--ini" ] + expectedOutput: + - '/usr/local/etc/php/conf.d/docker-php-ext-apcu.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-exif.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-gd.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-intl.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-opcache.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-sodium.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-zip.ini' + - name: php-cli extensions + command: [ "/usr/local/bin/php", "-m" ] + expectedOutput: + - 'apcu' + - 'Core' + - 'ctype' + - 'curl' + - 'date' + - 'dom' + - 'exif' + - 'fileinfo' + - 'filter' + - 'gd' + - 'hash' + - 'iconv' + - 'intl' + - 'json' + - 'libxml' + - 'mbstring' + - 'mysqlnd' + - 'openssl' + - 'pcre' + - 'PDO' + - 'pdo_mysql' + - 'Phar' + - 'posix' + - 'readline' + - 'Reflection' + - 'session' + - 'SimpleXML' + - 'sodium' + - 'SPL' + - 'standard' + - 'tokenizer' + - 'xml' + - 'xmlreader' + - 'xmlwriter' + - 'Zend OPcache' + - 'zip' + - 'zlib' diff --git a/frankenphp/testdata/frankenphp1.5-php8.2_arm64.yaml b/frankenphp/testdata/frankenphp1.5-php8.2_arm64.yaml new file mode 100644 index 0000000..0eb7a34 --- /dev/null +++ b/frankenphp/testdata/frankenphp1.5-php8.2_arm64.yaml @@ -0,0 +1,118 @@ +schemaVersion: "1.0.0" +fileExistenceTests: + - name: php-fpm executable + path: '/usr/local/sbin/php-fpm' + shouldExist: true + - name: php executable + path: '/usr/local/bin/php' + shouldExist: true + - name: 'Composer 755' + path: '/usr/bin/composer' + shouldExist: true + permissions: '-rwxr-xr-x' + - name: 'PHP Entry point 755' + path: '/usr/local/bin/docker-php-entrypoint' + shouldExist: true + permissions: '-rwxr-xr-x' +commandTests: + - name: arch + command: [ "uname", "-m" ] + expectedOutput: [ "aarch64" ] + - name: php-fpm version + command: [ "/usr/local/sbin/php-fpm", "--version" ] + expectedOutput: [ "PHP 8.2" ] + - name: php-fpm-modules + command: [ "/usr/local/sbin/php-fpm", "-m" ] + expectedOutput: + - 'apcu' + - 'cgi-fcgi' + - 'Core' + - 'ctype' + - 'curl' + - 'date' + - 'dom' + - 'exif' + - 'fileinfo' + - 'filter' + - 'gd' + - 'hash' + - 'iconv' + - 'intl' + - 'json' + - 'libxml' + - 'mbstring' + - 'mysqlnd' + - 'openssl' + - 'pcre' + - 'PDO' + - 'pdo_mysql' + - 'Phar' + - 'posix' + - 'readline' + - 'Reflection' + - 'session' + - 'SimpleXML' + - 'sodium' + - 'SPL' + - 'standard' + - 'tokenizer' + - 'xml' + - 'xmlreader' + - 'xmlwriter' + - 'Zend OPcache' + - 'zip' + - 'zlib' + - name: php-cli version + command: [ "/usr/local/bin/php", "--version" ] + expectedOutput: [ "PHP 8.2" ] + - name: config-files + command: [ "/usr/local/bin/php", "--ini" ] + expectedOutput: + - '/usr/local/etc/php/conf.d/docker-php-ext-apcu.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-exif.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-gd.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-intl.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-opcache.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-sodium.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-zip.ini' + - name: php-cli extensions + command: [ "/usr/local/bin/php", "-m" ] + expectedOutput: + - 'apcu' + - 'Core' + - 'ctype' + - 'curl' + - 'date' + - 'dom' + - 'exif' + - 'fileinfo' + - 'filter' + - 'gd' + - 'hash' + - 'iconv' + - 'intl' + - 'json' + - 'libxml' + - 'mbstring' + - 'mysqlnd' + - 'openssl' + - 'pcre' + - 'PDO' + - 'pdo_mysql' + - 'Phar' + - 'posix' + - 'readline' + - 'Reflection' + - 'session' + - 'SimpleXML' + - 'sodium' + - 'SPL' + - 'standard' + - 'tokenizer' + - 'xml' + - 'xmlreader' + - 'xmlwriter' + - 'Zend OPcache' + - 'zip' + - 'zlib' diff --git a/frankenphp/testdata/frankenphp1.5-php8.3_amd64.yaml b/frankenphp/testdata/frankenphp1.5-php8.3_amd64.yaml new file mode 100644 index 0000000..123f20d --- /dev/null +++ b/frankenphp/testdata/frankenphp1.5-php8.3_amd64.yaml @@ -0,0 +1,118 @@ +schemaVersion: "1.0.0" +fileExistenceTests: + - name: php-fpm executable + path: '/usr/local/sbin/php-fpm' + shouldExist: true + - name: php executable + path: '/usr/local/bin/php' + shouldExist: true + - name: 'Composer 755' + path: '/usr/bin/composer' + shouldExist: true + permissions: '-rwxr-xr-x' + - name: 'PHP Entry point 755' + path: '/usr/local/bin/docker-php-entrypoint' + shouldExist: true + permissions: '-rwxr-xr-x' +commandTests: + - name: arch + command: [ "uname", "-m" ] + expectedOutput: [ "x86_64" ] + - name: php-fpm version + command: [ "/usr/local/sbin/php-fpm", "--version" ] + expectedOutput: [ "PHP 8.3" ] + - name: php-fpm-modules + command: [ "/usr/local/sbin/php-fpm", "-m" ] + expectedOutput: + - 'apcu' + - 'cgi-fcgi' + - 'Core' + - 'ctype' + - 'curl' + - 'date' + - 'dom' + - 'exif' + - 'fileinfo' + - 'filter' + - 'gd' + - 'hash' + - 'iconv' + - 'intl' + - 'json' + - 'libxml' + - 'mbstring' + - 'mysqlnd' + - 'openssl' + - 'pcre' + - 'PDO' + - 'pdo_mysql' + - 'Phar' + - 'posix' + - 'readline' + - 'Reflection' + - 'session' + - 'SimpleXML' + - 'sodium' + - 'SPL' + - 'standard' + - 'tokenizer' + - 'xml' + - 'xmlreader' + - 'xmlwriter' + - 'Zend OPcache' + - 'zip' + - 'zlib' + - name: php-cli version + command: [ "/usr/local/bin/php", "--version" ] + expectedOutput: [ "PHP 8.3" ] + - name: config-files + command: [ "/usr/local/bin/php", "--ini" ] + expectedOutput: + - '/usr/local/etc/php/conf.d/docker-php-ext-apcu.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-exif.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-gd.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-intl.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-opcache.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-sodium.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-zip.ini' + - name: php-cli extensions + command: [ "/usr/local/bin/php", "-m" ] + expectedOutput: + - 'apcu' + - 'Core' + - 'ctype' + - 'curl' + - 'date' + - 'dom' + - 'exif' + - 'fileinfo' + - 'filter' + - 'gd' + - 'hash' + - 'iconv' + - 'intl' + - 'json' + - 'libxml' + - 'mbstring' + - 'mysqlnd' + - 'openssl' + - 'pcre' + - 'PDO' + - 'pdo_mysql' + - 'Phar' + - 'posix' + - 'readline' + - 'Reflection' + - 'session' + - 'SimpleXML' + - 'sodium' + - 'SPL' + - 'standard' + - 'tokenizer' + - 'xml' + - 'xmlreader' + - 'xmlwriter' + - 'Zend OPcache' + - 'zip' + - 'zlib' diff --git a/frankenphp/testdata/frankenphp1.5-php8.3_arm64.yaml b/frankenphp/testdata/frankenphp1.5-php8.3_arm64.yaml new file mode 100644 index 0000000..ef4091e --- /dev/null +++ b/frankenphp/testdata/frankenphp1.5-php8.3_arm64.yaml @@ -0,0 +1,118 @@ +schemaVersion: "1.0.0" +fileExistenceTests: + - name: php-fpm executable + path: '/usr/local/sbin/php-fpm' + shouldExist: true + - name: php executable + path: '/usr/local/bin/php' + shouldExist: true + - name: 'Composer 755' + path: '/usr/bin/composer' + shouldExist: true + permissions: '-rwxr-xr-x' + - name: 'PHP Entry point 755' + path: '/usr/local/bin/docker-php-entrypoint' + shouldExist: true + permissions: '-rwxr-xr-x' +commandTests: + - name: arch + command: [ "uname", "-m" ] + expectedOutput: [ "aarch64" ] + - name: php-fpm version + command: [ "/usr/local/sbin/php-fpm", "--version" ] + expectedOutput: [ "PHP 8.3" ] + - name: php-fpm-modules + command: [ "/usr/local/sbin/php-fpm", "-m" ] + expectedOutput: + - 'apcu' + - 'cgi-fcgi' + - 'Core' + - 'ctype' + - 'curl' + - 'date' + - 'dom' + - 'exif' + - 'fileinfo' + - 'filter' + - 'gd' + - 'hash' + - 'iconv' + - 'intl' + - 'json' + - 'libxml' + - 'mbstring' + - 'mysqlnd' + - 'openssl' + - 'pcre' + - 'PDO' + - 'pdo_mysql' + - 'Phar' + - 'posix' + - 'readline' + - 'Reflection' + - 'session' + - 'SimpleXML' + - 'sodium' + - 'SPL' + - 'standard' + - 'tokenizer' + - 'xml' + - 'xmlreader' + - 'xmlwriter' + - 'Zend OPcache' + - 'zip' + - 'zlib' + - name: php-cli version + command: [ "/usr/local/bin/php", "--version" ] + expectedOutput: [ "PHP 8.3" ] + - name: config-files + command: [ "/usr/local/bin/php", "--ini" ] + expectedOutput: + - '/usr/local/etc/php/conf.d/docker-php-ext-apcu.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-exif.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-gd.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-intl.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-opcache.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-sodium.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-zip.ini' + - name: php-cli extensions + command: [ "/usr/local/bin/php", "-m" ] + expectedOutput: + - 'apcu' + - 'Core' + - 'ctype' + - 'curl' + - 'date' + - 'dom' + - 'exif' + - 'fileinfo' + - 'filter' + - 'gd' + - 'hash' + - 'iconv' + - 'intl' + - 'json' + - 'libxml' + - 'mbstring' + - 'mysqlnd' + - 'openssl' + - 'pcre' + - 'PDO' + - 'pdo_mysql' + - 'Phar' + - 'posix' + - 'readline' + - 'Reflection' + - 'session' + - 'SimpleXML' + - 'sodium' + - 'SPL' + - 'standard' + - 'tokenizer' + - 'xml' + - 'xmlreader' + - 'xmlwriter' + - 'Zend OPcache' + - 'zip' + - 'zlib' diff --git a/frankenphp/testdata/frankenphp1.5-php8.4_amd64.yaml b/frankenphp/testdata/frankenphp1.5-php8.4_amd64.yaml new file mode 100644 index 0000000..e7eccb5 --- /dev/null +++ b/frankenphp/testdata/frankenphp1.5-php8.4_amd64.yaml @@ -0,0 +1,118 @@ +schemaVersion: "1.0.0" +fileExistenceTests: + - name: php-fpm executable + path: '/usr/local/sbin/php-fpm' + shouldExist: true + - name: php executable + path: '/usr/local/bin/php' + shouldExist: true + - name: 'Composer 755' + path: '/usr/bin/composer' + shouldExist: true + permissions: '-rwxr-xr-x' + - name: 'PHP Entry point 755' + path: '/usr/local/bin/docker-php-entrypoint' + shouldExist: true + permissions: '-rwxr-xr-x' +commandTests: + - name: arch + command: [ "uname", "-m" ] + expectedOutput: [ "x86_64" ] + - name: php-fpm version + command: [ "/usr/local/sbin/php-fpm", "--version" ] + expectedOutput: [ "PHP 8.4" ] + - name: php-fpm-modules + command: [ "/usr/local/sbin/php-fpm", "-m" ] + expectedOutput: + - 'apcu' + - 'cgi-fcgi' + - 'Core' + - 'ctype' + - 'curl' + - 'date' + - 'dom' + - 'exif' + - 'fileinfo' + - 'filter' + - 'gd' + - 'hash' + - 'iconv' + - 'intl' + - 'json' + - 'libxml' + - 'mbstring' + - 'mysqlnd' + - 'openssl' + - 'pcre' + - 'PDO' + - 'pdo_mysql' + - 'Phar' + - 'posix' + - 'readline' + - 'Reflection' + - 'session' + - 'SimpleXML' + - 'sodium' + - 'SPL' + - 'standard' + - 'tokenizer' + - 'xml' + - 'xmlreader' + - 'xmlwriter' + - 'Zend OPcache' + - 'zip' + - 'zlib' + - name: php-cli version + command: [ "/usr/local/bin/php", "--version" ] + expectedOutput: [ "PHP 8.4" ] + - name: config-files + command: [ "/usr/local/bin/php", "--ini" ] + expectedOutput: + - '/usr/local/etc/php/conf.d/docker-php-ext-apcu.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-exif.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-gd.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-intl.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-opcache.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-sodium.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-zip.ini' + - name: php-cli extensions + command: [ "/usr/local/bin/php", "-m" ] + expectedOutput: + - 'apcu' + - 'Core' + - 'ctype' + - 'curl' + - 'date' + - 'dom' + - 'exif' + - 'fileinfo' + - 'filter' + - 'gd' + - 'hash' + - 'iconv' + - 'intl' + - 'json' + - 'libxml' + - 'mbstring' + - 'mysqlnd' + - 'openssl' + - 'pcre' + - 'PDO' + - 'pdo_mysql' + - 'Phar' + - 'posix' + - 'readline' + - 'Reflection' + - 'session' + - 'SimpleXML' + - 'sodium' + - 'SPL' + - 'standard' + - 'tokenizer' + - 'xml' + - 'xmlreader' + - 'xmlwriter' + - 'Zend OPcache' + - 'zip' + - 'zlib' diff --git a/frankenphp/testdata/frankenphp1.5-php8.4_arm64.yaml b/frankenphp/testdata/frankenphp1.5-php8.4_arm64.yaml new file mode 100644 index 0000000..9c4b469 --- /dev/null +++ b/frankenphp/testdata/frankenphp1.5-php8.4_arm64.yaml @@ -0,0 +1,118 @@ +schemaVersion: "1.0.0" +fileExistenceTests: + - name: php-fpm executable + path: '/usr/local/sbin/php-fpm' + shouldExist: true + - name: php executable + path: '/usr/local/bin/php' + shouldExist: true + - name: 'Composer 755' + path: '/usr/bin/composer' + shouldExist: true + permissions: '-rwxr-xr-x' + - name: 'PHP Entry point 755' + path: '/usr/local/bin/docker-php-entrypoint' + shouldExist: true + permissions: '-rwxr-xr-x' +commandTests: + - name: arch + command: [ "uname", "-m" ] + expectedOutput: [ "aarch64" ] + - name: php-fpm version + command: [ "/usr/local/sbin/php-fpm", "--version" ] + expectedOutput: [ "PHP 8.4" ] + - name: php-fpm-modules + command: [ "/usr/local/sbin/php-fpm", "-m" ] + expectedOutput: + - 'apcu' + - 'cgi-fcgi' + - 'Core' + - 'ctype' + - 'curl' + - 'date' + - 'dom' + - 'exif' + - 'fileinfo' + - 'filter' + - 'gd' + - 'hash' + - 'iconv' + - 'intl' + - 'json' + - 'libxml' + - 'mbstring' + - 'mysqlnd' + - 'openssl' + - 'pcre' + - 'PDO' + - 'pdo_mysql' + - 'Phar' + - 'posix' + - 'readline' + - 'Reflection' + - 'session' + - 'SimpleXML' + - 'sodium' + - 'SPL' + - 'standard' + - 'tokenizer' + - 'xml' + - 'xmlreader' + - 'xmlwriter' + - 'Zend OPcache' + - 'zip' + - 'zlib' + - name: php-cli version + command: [ "/usr/local/bin/php", "--version" ] + expectedOutput: [ "PHP 8.4" ] + - name: config-files + command: [ "/usr/local/bin/php", "--ini" ] + expectedOutput: + - '/usr/local/etc/php/conf.d/docker-php-ext-apcu.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-exif.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-gd.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-intl.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-opcache.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-sodium.ini' + - '/usr/local/etc/php/conf.d/docker-php-ext-zip.ini' + - name: php-cli extensions + command: [ "/usr/local/bin/php", "-m" ] + expectedOutput: + - 'apcu' + - 'Core' + - 'ctype' + - 'curl' + - 'date' + - 'dom' + - 'exif' + - 'fileinfo' + - 'filter' + - 'gd' + - 'hash' + - 'iconv' + - 'intl' + - 'json' + - 'libxml' + - 'mbstring' + - 'mysqlnd' + - 'openssl' + - 'pcre' + - 'PDO' + - 'pdo_mysql' + - 'Phar' + - 'posix' + - 'readline' + - 'Reflection' + - 'session' + - 'SimpleXML' + - 'sodium' + - 'SPL' + - 'standard' + - 'tokenizer' + - 'xml' + - 'xmlreader' + - 'xmlwriter' + - 'Zend OPcache' + - 'zip' + - 'zlib' diff --git a/frankenphp/worker.Caddyfile b/frankenphp/worker.Caddyfile new file mode 100644 index 0000000..d384ae4 --- /dev/null +++ b/frankenphp/worker.Caddyfile @@ -0,0 +1,4 @@ +worker { + file ./public/index.php + env APP_RUNTIME Runtime\FrankenPhpSymfony\Runtime +} diff --git a/frankenphp/xdebug.Dockerfile b/frankenphp/xdebug.Dockerfile new file mode 100644 index 0000000..89d2f18 --- /dev/null +++ b/frankenphp/xdebug.Dockerfile @@ -0,0 +1,24 @@ +ARG IMAGE_NAME +ARG IMAGE_TAG + +ARG XDEBUG_VERSION=3.1.2 + +FROM ${IMAGE_NAME}:${IMAGE_TAG} + +ARG XDEBUG_VERSION + +RUN if [ "$(awk -F= '/^NAME/{print $2}' /etc/os-release)" = '"Ubuntu"' ] then \ + set -eux \ + && apt install build-essentials \ + && pecl install xdebug-$XDEBUG_VERSION \ + && docker-php-ext-enable xdebug \ + && apt autoclean; \ +fi + +RUN if [ "$(awk -F= '/^NAME/{print $2}' /etc/os-release)" = '"Alpine Linux"' ] then \ + set -eux \ + && apk add --no-cache --virtual .build-deps $PHPIZE_DEPS linux-headers \ + && pecl install xdebug-$XDEBUG_VERSION \ + && docker-php-ext-enable xdebug \ + && apk del .build-deps; \ +fi From 28f12591879ff51172a33f014f209a79d74e2ff6 Mon Sep 17 00:00:00 2001 From: Francis Hilaire Date: Sat, 29 Mar 2025 19:25:27 +0100 Subject: [PATCH 02/43] Set local credentials --- .github/workflows/sylius-frankenphp.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sylius-frankenphp.yml b/.github/workflows/sylius-frankenphp.yml index 3770eed..642814a 100644 --- a/.github/workflows/sylius-frankenphp.yml +++ b/.github/workflows/sylius-frankenphp.yml @@ -69,9 +69,9 @@ jobs: - name: Docker Login uses: docker/login-action@v3 with: - registry: ${{ secrets.DOCKER_REGISTRY }} - username: ${{ secrets.DOCKER_REPOSITORY_LOGIN }} - password: ${{ secrets.DOCKER_REPOSITORY_PASSWORD }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} logout: true - name: Build multiplatform From ff7a52c88e11679d0b82c9adfe0912d20cda7b13 Mon Sep 17 00:00:00 2001 From: Mathieu Ledru Date: Sat, 29 Mar 2025 19:46:36 +0100 Subject: [PATCH 03/43] Add composer --- frankenphp/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frankenphp/Dockerfile b/frankenphp/Dockerfile index 9337819..5d8fbb0 100644 --- a/frankenphp/Dockerfile +++ b/frankenphp/Dockerfile @@ -92,8 +92,8 @@ COPY --link conf.d/app.prod.ini $PHP_INI_DIR/conf.d/ COPY --link conf.d/app-cli.ini $PHP_INI_DIR/conf.d/ COPY --link worker.Caddyfile /etc/caddy/worker.Caddyfile -# prevent the reinstallation of vendors at every changes in the source code -COPY --link composer.* symfony.* ./ +COPY --from=composer:latest /usr/bin/composer /usr/bin/composer + RUN set -eux; \ composer install --no-cache --prefer-dist --no-dev --no-autoloader --no-scripts --no-progress From 5aaaa948477629015bedcdea286492688eae833a Mon Sep 17 00:00:00 2001 From: Mathieu Ledru Date: Sat, 29 Mar 2025 19:55:38 +0100 Subject: [PATCH 04/43] Remove config preload --- frankenphp/Dockerfile | 11 ----------- frankenphp/conf.d/app.prod.ini | 1 - 2 files changed, 12 deletions(-) diff --git a/frankenphp/Dockerfile b/frankenphp/Dockerfile index 5d8fbb0..a20341f 100644 --- a/frankenphp/Dockerfile +++ b/frankenphp/Dockerfile @@ -92,14 +92,3 @@ COPY --link conf.d/app.prod.ini $PHP_INI_DIR/conf.d/ COPY --link conf.d/app-cli.ini $PHP_INI_DIR/conf.d/ COPY --link worker.Caddyfile /etc/caddy/worker.Caddyfile -COPY --from=composer:latest /usr/bin/composer /usr/bin/composer - -RUN set -eux; \ - composer install --no-cache --prefer-dist --no-dev --no-autoloader --no-scripts --no-progress - -RUN set -eux; \ - mkdir -p var/cache var/log; \ - composer dump-autoload --classmap-authoritative --no-dev; \ - composer dump-env prod; \ - composer run-script --no-dev post-install-cmd; \ - chmod +x bin/console; sync; diff --git a/frankenphp/conf.d/app.prod.ini b/frankenphp/conf.d/app.prod.ini index 3bcaa71..4df4f62 100644 --- a/frankenphp/conf.d/app.prod.ini +++ b/frankenphp/conf.d/app.prod.ini @@ -1,2 +1 @@ opcache.preload_user = root -opcache.preload = /app/config/preload.php From 9efafe255901a8f32c165c2d2e0c13f4b4b87e92 Mon Sep 17 00:00:00 2001 From: Mathieu Ledru Date: Sat, 29 Mar 2025 19:57:37 +0100 Subject: [PATCH 05/43] Remove 8.0 and 8.1 --- .github/workflows/sylius-frankenphp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sylius-frankenphp.yml b/.github/workflows/sylius-frankenphp.yml index 642814a..a0fc2f6 100644 --- a/.github/workflows/sylius-frankenphp.yml +++ b/.github/workflows/sylius-frankenphp.yml @@ -26,7 +26,7 @@ jobs: fail-fast: false matrix: frankenphp: [ "1.5-php" ] - php: [ "8.0", "8.1", "8.2", "8.3", "8.4" ] + php: [ "8.2", "8.3", "8.4" ] distro: [ "", "-alpine" ] steps: From 3839ceef30c91a025f1579dbe4f61a0af720039e Mon Sep 17 00:00:00 2001 From: Francis Hilaire Date: Sat, 29 Mar 2025 19:25:27 +0100 Subject: [PATCH 06/43] Set local credentials --- .github/workflows/sylius-frankenphp.yml | 10 +++++----- frankenphp/Dockerfile | 12 ------------ 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/.github/workflows/sylius-frankenphp.yml b/.github/workflows/sylius-frankenphp.yml index 3770eed..e064815 100644 --- a/.github/workflows/sylius-frankenphp.yml +++ b/.github/workflows/sylius-frankenphp.yml @@ -1,7 +1,7 @@ name: PHP Docker Image CI for Sylius on: - workflow_dispatch: + workflow_dispatch: ~ push: branches: [ frankenphp ] paths: @@ -26,7 +26,7 @@ jobs: fail-fast: false matrix: frankenphp: [ "1.5-php" ] - php: [ "8.0", "8.1", "8.2", "8.3", "8.4" ] + php: [ "8.2", "8.3", "8.4" ] distro: [ "", "-alpine" ] steps: @@ -69,9 +69,9 @@ jobs: - name: Docker Login uses: docker/login-action@v3 with: - registry: ${{ secrets.DOCKER_REGISTRY }} - username: ${{ secrets.DOCKER_REPOSITORY_LOGIN }} - password: ${{ secrets.DOCKER_REPOSITORY_PASSWORD }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} logout: true - name: Build multiplatform diff --git a/frankenphp/Dockerfile b/frankenphp/Dockerfile index 9337819..978c387 100644 --- a/frankenphp/Dockerfile +++ b/frankenphp/Dockerfile @@ -91,15 +91,3 @@ RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" COPY --link conf.d/app.prod.ini $PHP_INI_DIR/conf.d/ COPY --link conf.d/app-cli.ini $PHP_INI_DIR/conf.d/ COPY --link worker.Caddyfile /etc/caddy/worker.Caddyfile - -# prevent the reinstallation of vendors at every changes in the source code -COPY --link composer.* symfony.* ./ -RUN set -eux; \ - composer install --no-cache --prefer-dist --no-dev --no-autoloader --no-scripts --no-progress - -RUN set -eux; \ - mkdir -p var/cache var/log; \ - composer dump-autoload --classmap-authoritative --no-dev; \ - composer dump-env prod; \ - composer run-script --no-dev post-install-cmd; \ - chmod +x bin/console; sync; From 7969d7bebfff2bbfa3dc6faeab343ffa45a1d38c Mon Sep 17 00:00:00 2001 From: Mathieu Ledru Date: Sat, 29 Mar 2025 20:43:46 +0100 Subject: [PATCH 07/43] Update frankenphp workflow --- .github/workflows/sylius-frankenphp.yml | 37 ++----------------------- 1 file changed, 2 insertions(+), 35 deletions(-) diff --git a/.github/workflows/sylius-frankenphp.yml b/.github/workflows/sylius-frankenphp.yml index a0fc2f6..984fb8b 100644 --- a/.github/workflows/sylius-frankenphp.yml +++ b/.github/workflows/sylius-frankenphp.yml @@ -1,18 +1,9 @@ name: PHP Docker Image CI for Sylius on: - workflow_dispatch: push: - branches: [ frankenphp ] - paths: - - 'frankenphp/**' - - 'WORKSPACE' - schedule: - - cron: '0 20 * * 5' - -concurrency: - group: sylius_frankenphp_build - cancel-in-progress: false + branches: + - frankenphp jobs: @@ -115,30 +106,6 @@ jobs: cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new-arm64 outputs: type=docker,dest=./external/image-arm64.tar - - name: Mount Bazel cache - uses: actions/cache@v4 - with: - path: "~/.cache/bazel" - key: "${{ runner.os }}-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-bazel-cache-${{ vars.CACHE_VERSION }}-${{ steps.generate-uuid.outputs.uuid }}" - restore-keys: "${{ runner.os }}-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-bazel-cache-${{ vars.CACHE_VERSION }}-" - - - name: Setup PHP for Bazel - run: | - set -ex - cat > frankenphp/frankenphp-version.bzl < frankenphp/frankenphp-arch.bzl < Date: Sat, 29 Mar 2025 21:32:44 +0100 Subject: [PATCH 08/43] test push image --- .github/workflows/sylius-frankenphp.yml | 97 ++----------------------- 1 file changed, 5 insertions(+), 92 deletions(-) diff --git a/.github/workflows/sylius-frankenphp.yml b/.github/workflows/sylius-frankenphp.yml index 984fb8b..b8fd809 100644 --- a/.github/workflows/sylius-frankenphp.yml +++ b/.github/workflows/sylius-frankenphp.yml @@ -1,9 +1,9 @@ name: PHP Docker Image CI for Sylius on: - push: - branches: - - frankenphp + push: + branches: + - frankenphp jobs: @@ -37,7 +37,7 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: ${{ vars.DOCKER_FRANKENPHP_REPOSITORY_NAME }} + images: ghcr.io/${{ github.repository_owner }}/sylius-frankenphp-1.5-php8.2 tags: | type=raw,value=${{ matrix.frankenphp }}${{ matrix.php }}${{ matrix.distro }} labels: | @@ -113,7 +113,7 @@ jobs: context: ./frankenphp build-args: "FRANKENPHP_VERSION=${{ matrix.frankenphp }}${{ matrix.php }}" platforms: linux/amd64,linux/arm64 - push: ${{ github.ref == 'refs/heads/main' || github.event_name == 'release' }} + push: true pull: false tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} @@ -124,90 +124,3 @@ jobs: run: | rm -rf /tmp/.buildx-cache mv /tmp/.buildx-cache-new /tmp/.buildx-cache - - build-xdebug: - needs: build - - name: "Sylius PHP with Xdebug - ${{ matrix.frankenphp }}${{ matrix.php }}${{ matrix.distro }}" - - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - frankenphp: [ "1.5-php" ] - php: [ "8.0", "8.1", "8.2", "8.3", "8.4" ] - distro: [ "", "-alpine" ] - - steps: - - - uses: actions/checkout@v4 - - - name: Generate UUID - id: generate-uuid - run: | - UUID=$(cat /proc/sys/kernel/random/uuid) - echo "UUID=${UUID}" >> $GITHUB_OUTPUT - - - name: Set up QEMU - id: qemu - uses: docker/setup-qemu-action@v3 - - - name: Available platforms - run: echo ${{ steps.qemu.outputs.platforms }} - - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ vars.DOCKER_FRANKENPHP_REPOSITORY_NAME }} - tags: | - type=raw,value=${{ matrix.frankenphp }}${{ matrix.php }}-xdebug${{ matrix.distro }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Cache Docker layers - uses: actions/cache@v4 - with: - path: /tmp/.buildx-cache - key: "${{ runner.os }}-frankenphp-xdebug-${{ matrix.frankenphp }}${{ matrix.php }}${{ matrix.distro }}-buildx-cache-${{ vars.CACHE_VERSION }}-${{ steps.generate-uuid.outputs.uuid }}" - # https://github.com/actions/cache/issues/109#issuecomment-558771281 - # https://github.community/t/always-save-new-cache-for-incremental-builds/172791 - restore-keys: "${{ runner.os }}-frankenphp-xdebug-${{ matrix.frankenphp }}${{ matrix.php }}${{ matrix.distro }}-buildx-cache-${{ vars.CACHE_VERSION }}-" - - - name: Docker Login - uses: docker/login-action@v3 - with: - registry: ${{ secrets.DOCKER_REGISTRY }} - username: ${{ secrets.DOCKER_REPOSITORY_LOGIN }} - password: ${{ secrets.DOCKER_REPOSITORY_PASSWORD }} - logout: true - - - name: Prepare variable names for Docker build - id: docker-build-variable-names - run: | - PHP_VERSION="${{ matrix.php }}" - PHP_XDEBUG_VERSION_VARIABLE=XDEBUG_VERSION_PHP_${PHP_VERSION//./_} - echo "XDEBUG_VERSION=$(jq -r --arg PHP_XDEBUG_VERSION_VARIABLE "$PHP_XDEBUG_VERSION_VARIABLE" '.[$PHP_XDEBUG_VERSION_VARIABLE]' <<< '${{ toJSON(vars) }}')" >> $GITHUB_ENV - - - name: Build and push - uses: docker/build-push-action@v5 - with: - file: ./frankenphp/xdebug.Dockerfile - context: ./frankenphp - build-args: | - "IMAGE_NAME=${{ vars.DOCKER_FRANKENPHP_REPOSITORY_NAME }}" - "IMAGE_TAG=${{ matrix.frankenphp }}${{ matrix.php }}${{ matrix.distro }}" - "XDEBUG_VERSION=${{ env.XDEBUG_VERSION }}" - platforms: linux/amd64,linux/arm64 - push: ${{ github.ref == 'refs/heads/main' || github.event_name == 'release' }} - pull: true - tags: ${{ steps.meta.outputs.tags }} - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new - - - name: Move cache - run: | - rm -rf /tmp/.buildx-cache - mv /tmp/.buildx-cache-new /tmp/.buildx-cache From e1c057cc4325efee055144cc10f08a4640e54c43 Mon Sep 17 00:00:00 2001 From: Mathieu Ledru Date: Sat, 29 Mar 2025 23:36:00 +0100 Subject: [PATCH 09/43] Add extensions --- frankenphp/Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frankenphp/Dockerfile b/frankenphp/Dockerfile index a20341f..ef46b05 100644 --- a/frankenphp/Dockerfile +++ b/frankenphp/Dockerfile @@ -48,6 +48,10 @@ RUN set -eux; \ intl \ opcache \ zip \ + exif \ + gd \ + intl \ + pdo_mysql \ ; RUN set -eux; \ From 951b4bbe1de7d1c1d2fd7fbedf65d1fdef83adee Mon Sep 17 00:00:00 2001 From: Mathieu Ledru Date: Sat, 29 Mar 2025 23:38:01 +0100 Subject: [PATCH 10/43] Dynamic packages --- .github/workflows/sylius-frankenphp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sylius-frankenphp.yml b/.github/workflows/sylius-frankenphp.yml index b8fd809..704cc5a 100644 --- a/.github/workflows/sylius-frankenphp.yml +++ b/.github/workflows/sylius-frankenphp.yml @@ -37,7 +37,7 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: ghcr.io/${{ github.repository_owner }}/sylius-frankenphp-1.5-php8.2 + images: ghcr.io/${{ github.repository_owner }}/sylius-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}${{ matrix.distro }} tags: | type=raw,value=${{ matrix.frankenphp }}${{ matrix.php }}${{ matrix.distro }} labels: | From b930686491cf0b82fa7f3deb7ffb2bc441161172 Mon Sep 17 00:00:00 2001 From: Mathieu Ledru Date: Sun, 30 Mar 2025 12:35:30 +0200 Subject: [PATCH 11/43] cleanup space --- frankenphp/fixuid.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frankenphp/fixuid.Dockerfile b/frankenphp/fixuid.Dockerfile index af50492..0d3d12a 100644 --- a/frankenphp/fixuid.Dockerfile +++ b/frankenphp/fixuid.Dockerfile @@ -27,4 +27,4 @@ RUN USER=sylius && \ # Fix permissions during named volume creation RUN mkdir -p /srv/sylius/public/media && chmod 777 -R /srv/sylius -USER sylius:sylius \ No newline at end of file +USER sylius:sylius \ No newline at end of file From 2549604349d58bda9dd435dae6be37563873a8c1 Mon Sep 17 00:00:00 2001 From: Mathieu Ledru Date: Sun, 30 Mar 2025 13:01:26 +0200 Subject: [PATCH 12/43] Rollback workflow dispatch --- .github/workflows/sylius-frankenphp.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sylius-frankenphp.yml b/.github/workflows/sylius-frankenphp.yml index 704cc5a..54678a9 100644 --- a/.github/workflows/sylius-frankenphp.yml +++ b/.github/workflows/sylius-frankenphp.yml @@ -1,9 +1,14 @@ name: PHP Docker Image CI for Sylius on: - push: - branches: - - frankenphp + workflow_dispatch: + push: + branches: [ frankenphp ] + paths: + - 'frankenphp/**' + - 'WORKSPACE' + schedule: + - cron: '0 20 * * 5' jobs: From e1c1ab7ee356b18df3dc3cf2b4912b36180d5459 Mon Sep 17 00:00:00 2001 From: Mathieu Ledru Date: Sun, 30 Mar 2025 16:32:19 +0200 Subject: [PATCH 13/43] Update mercure data path --- frankenphp/Caddyfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frankenphp/Caddyfile b/frankenphp/Caddyfile index e420385..fd9d47d 100644 --- a/frankenphp/Caddyfile +++ b/frankenphp/Caddyfile @@ -23,7 +23,7 @@ mercure { # Transport to use (default to Bolt) - transport_url {$MERCURE_TRANSPORT_URL:bolt:///data/mercure.db} + transport_url {$MERCURE_TRANSPORT_URL:bolt:///mercure-config/mercure.db} # Publisher JWT key publisher_jwt {env.MERCURE_PUBLISHER_JWT_KEY} {env.MERCURE_PUBLISHER_JWT_ALG} # Subscriber JWT key From afa549dc8b7711939ab06ea04a686f89f2e39fe7 Mon Sep 17 00:00:00 2001 From: Mathieu Ledru Date: Sun, 30 Mar 2025 16:47:11 +0200 Subject: [PATCH 14/43] Running as a Non-Root User --- frankenphp/Dockerfile | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/frankenphp/Dockerfile b/frankenphp/Dockerfile index ef46b05..db34735 100644 --- a/frankenphp/Dockerfile +++ b/frankenphp/Dockerfile @@ -66,13 +66,31 @@ ENTRYPOINT ["docker-entrypoint"] HEALTHCHECK --start-period=60s CMD curl -f http://localhost:2019/metrics || exit 1 CMD [ "frankenphp", "run", "--config", "/etc/caddy/Caddyfile" ] +ARG USER=appuser + +# First prepare the PHP configurations before switching user +RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini.production.backup" +RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini.development.backup" + +RUN \ + # Use "adduser -D ${USER}" for alpine based distros + useradd ${USER}; \ + # Add additional capability to bind to port 80 and 443 + setcap CAP_NET_BIND_SERVICE=+eip /usr/local/bin/frankenphp; \ + # Give write access to /data/caddy and /config/caddy + chown -R ${USER}:${USER} /caddy-data/caddy && chown -R ${USER}:${USER} /caddy-config/caddy; \ + # Give write access to PHP_INI_DIR + chown -R ${USER}:${USER} $PHP_INI_DIR + +USER ${USER} + # Dev FrankenPHP image FROM frankenphp_base AS frankenphp_dev ENV APP_ENV=dev XDEBUG_MODE=off VOLUME /app/var/ -RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" +RUN cp "$PHP_INI_DIR/php.ini.development.backup" "$PHP_INI_DIR/php.ini" RUN set -eux; \ install-php-extensions \ @@ -90,7 +108,7 @@ FROM frankenphp_base AS frankenphp_prod ENV APP_ENV=prod ENV FRANKENPHP_CONFIG="import worker.Caddyfile" -RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" +RUN cp "$PHP_INI_DIR/php.ini.production.backup" "$PHP_INI_DIR/php.ini" COPY --link conf.d/app.prod.ini $PHP_INI_DIR/conf.d/ COPY --link conf.d/app-cli.ini $PHP_INI_DIR/conf.d/ From 4ab004d5ad762f26a00ea74a9879bfbc437cd6ec Mon Sep 17 00:00:00 2001 From: Mathieu Ledru Date: Sun, 30 Mar 2025 16:59:57 +0200 Subject: [PATCH 15/43] Rollback folders and non root user permissions --- frankenphp/Caddyfile | 2 +- frankenphp/Dockerfile | 18 ------------------ 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/frankenphp/Caddyfile b/frankenphp/Caddyfile index fd9d47d..e420385 100644 --- a/frankenphp/Caddyfile +++ b/frankenphp/Caddyfile @@ -23,7 +23,7 @@ mercure { # Transport to use (default to Bolt) - transport_url {$MERCURE_TRANSPORT_URL:bolt:///mercure-config/mercure.db} + transport_url {$MERCURE_TRANSPORT_URL:bolt:///data/mercure.db} # Publisher JWT key publisher_jwt {env.MERCURE_PUBLISHER_JWT_KEY} {env.MERCURE_PUBLISHER_JWT_ALG} # Subscriber JWT key diff --git a/frankenphp/Dockerfile b/frankenphp/Dockerfile index db34735..0ae0660 100644 --- a/frankenphp/Dockerfile +++ b/frankenphp/Dockerfile @@ -66,24 +66,6 @@ ENTRYPOINT ["docker-entrypoint"] HEALTHCHECK --start-period=60s CMD curl -f http://localhost:2019/metrics || exit 1 CMD [ "frankenphp", "run", "--config", "/etc/caddy/Caddyfile" ] -ARG USER=appuser - -# First prepare the PHP configurations before switching user -RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini.production.backup" -RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini.development.backup" - -RUN \ - # Use "adduser -D ${USER}" for alpine based distros - useradd ${USER}; \ - # Add additional capability to bind to port 80 and 443 - setcap CAP_NET_BIND_SERVICE=+eip /usr/local/bin/frankenphp; \ - # Give write access to /data/caddy and /config/caddy - chown -R ${USER}:${USER} /caddy-data/caddy && chown -R ${USER}:${USER} /caddy-config/caddy; \ - # Give write access to PHP_INI_DIR - chown -R ${USER}:${USER} $PHP_INI_DIR - -USER ${USER} - # Dev FrankenPHP image FROM frankenphp_base AS frankenphp_dev From d6a6604030d57f7f2581220f7723507347f629a2 Mon Sep 17 00:00:00 2001 From: Mathieu Ledru Date: Sun, 30 Mar 2025 17:11:58 +0200 Subject: [PATCH 16/43] Move backup php ini --- frankenphp/Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frankenphp/Dockerfile b/frankenphp/Dockerfile index 0ae0660..98ace11 100644 --- a/frankenphp/Dockerfile +++ b/frankenphp/Dockerfile @@ -66,6 +66,9 @@ ENTRYPOINT ["docker-entrypoint"] HEALTHCHECK --start-period=60s CMD curl -f http://localhost:2019/metrics || exit 1 CMD [ "frankenphp", "run", "--config", "/etc/caddy/Caddyfile" ] +RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini.production.backup" +RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini.development.backup" + # Dev FrankenPHP image FROM frankenphp_base AS frankenphp_dev From 23dea53c173d8d1e7f33b6b3cdc430ac85314a51 Mon Sep 17 00:00:00 2001 From: Mathieu Ledru Date: Sun, 30 Mar 2025 17:24:31 +0200 Subject: [PATCH 17/43] Update mercure transport url data path --- frankenphp/Caddyfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frankenphp/Caddyfile b/frankenphp/Caddyfile index e420385..bd6baa9 100644 --- a/frankenphp/Caddyfile +++ b/frankenphp/Caddyfile @@ -23,7 +23,7 @@ mercure { # Transport to use (default to Bolt) - transport_url {$MERCURE_TRANSPORT_URL:bolt:///data/mercure.db} + transport_url {$MERCURE_TRANSPORT_URL:bolt:///frankenphp-data/mercure.db} # Publisher JWT key publisher_jwt {env.MERCURE_PUBLISHER_JWT_KEY} {env.MERCURE_PUBLISHER_JWT_ALG} # Subscriber JWT key From 2c62aea9fceb52f1a7e7cd20b549fd7b5be92bd5 Mon Sep 17 00:00:00 2001 From: Mathieu Ledru Date: Sun, 30 Mar 2025 17:50:55 +0200 Subject: [PATCH 18/43] Resolve certificate installation --- frankenphp/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frankenphp/Dockerfile b/frankenphp/Dockerfile index 98ace11..628ee25 100644 --- a/frankenphp/Dockerfile +++ b/frankenphp/Dockerfile @@ -26,6 +26,7 @@ RUN if [ "$(awk -F= '/^NAME/{print $2}' /etc/os-release)" = '"Ubuntu"' ]; then \ file \ gettext \ git \ + libnss3-tools \ && rm -rf /var/lib/apt/lists/*; \ fi RUN if [ "$(awk -F= '/^NAME/{print $2}' /etc/os-release)" = '"Alpine Linux"' ]; then \ @@ -35,6 +36,7 @@ RUN if [ "$(awk -F= '/^NAME/{print $2}' /etc/os-release)" = '"Alpine Linux"' ]; file \ gettext \ git \ + nss-tools \ && apk del .build-deps; \ fi From 7fa0e82aa21534c315045a1d87407dee9b27fbfb Mon Sep 17 00:00:00 2001 From: Francis Hilaire Date: Sun, 30 Mar 2025 19:25:27 +0200 Subject: [PATCH 19/43] Update workflow to build only alpine images and use local credentials for xdebug image --- .github/workflows/sylius-frankenphp.yml | 44 ++++++++++++------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/sylius-frankenphp.yml b/.github/workflows/sylius-frankenphp.yml index e064815..46116e2 100644 --- a/.github/workflows/sylius-frankenphp.yml +++ b/.github/workflows/sylius-frankenphp.yml @@ -18,7 +18,7 @@ jobs: build: - name: "Sylius FrankenPHP - ${{ matrix.frankenphp }}${{ matrix.php }}${{ matrix.distro }}" + name: "Sylius FrankenPHP - ${{ matrix.frankenphp }}${{ matrix.php }} ${{ matrix.distro }}" runs-on: ubuntu-latest @@ -27,7 +27,7 @@ jobs: matrix: frankenphp: [ "1.5-php" ] php: [ "8.2", "8.3", "8.4" ] - distro: [ "", "-alpine" ] + distro: [ "alpine" ] steps: @@ -46,9 +46,9 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: ${{ vars.DOCKER_FRANKENPHP_REPOSITORY_NAME }} + images: ghcr.io/${{ github.repository_owner }}/sylius-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }} tags: | - type=raw,value=${{ matrix.frankenphp }}${{ matrix.php }}${{ matrix.distro }} + type=raw,value=${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }} labels: | org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }} org.opencontainers.image.description=Sylius FrankenPHP ${{ matrix.frankenphp }}${{ matrix.php }} Docker image @@ -61,10 +61,10 @@ jobs: uses: actions/cache@v4 with: path: /tmp/.buildx-cache - key: "${{ runner.os }}-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}${{ matrix.distro }}-buildx-cache-${{ vars.CACHE_VERSION }}-${{ steps.generate-uuid.outputs.uuid }}" + key: "${{ runner.os }}-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-buildx-cache-${{ vars.CACHE_VERSION }}-${{ steps.generate-uuid.outputs.uuid }}" # https://github.com/actions/cache/issues/109#issuecomment-558771281 # https://github.community/t/always-save-new-cache-for-incremental-builds/172791 - restore-keys: "${{ runner.os }}-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}${{ matrix.distro }}-buildx-cache-${{ vars.CACHE_VERSION }}-" + restore-keys: "${{ runner.os }}-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-buildx-cache-${{ vars.CACHE_VERSION }}-" - name: Docker Login uses: docker/login-action@v3 @@ -79,7 +79,7 @@ jobs: with: file: ./frankenphp/Dockerfile context: ./frankenphp - build-args: "FRANKENPHP_VERSION=${{ matrix.frankenphp }}${{ matrix.php }}" + build-args: "FRANKENPHP_VERSION=${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}" platforms: linux/amd64,linux/arm64 push: false pull: true @@ -92,7 +92,7 @@ jobs: with: file: ./frankenphp/Dockerfile context: ./frankenphp - build-args: "FRANKENPHP_VERSION=${{ matrix.frankenphp }}${{ matrix.php }}" + build-args: "FRANKENPHP_VERSION=${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}" platforms: linux/amd64 push: false pull: false @@ -106,7 +106,7 @@ jobs: with: file: ./frankenphp/Dockerfile context: ./frankenphp - build-args: "FRANKENPHP_VERSION=${{ matrix.frankenphp }}${{ matrix.php }}" + build-args: "FRANKENPHP_VERSION=${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}" platforms: linux/arm64 push: false pull: false @@ -125,8 +125,8 @@ jobs: - name: Setup PHP for Bazel run: | set -ex - cat > frankenphp/frankenphp-version.bzl < frankenphp/php-version.bzl < frankenphp/frankenphp-arch.bzl < Date: Sun, 30 Mar 2025 19:26:03 +0200 Subject: [PATCH 20/43] Narrow down the tests --- frankenphp/BUILD | 8 +- ...md64.yaml => frankenphp-php8.2_amd64.yaml} | 0 ...rm64.yaml => frankenphp-php8.2_arm64.yaml} | 0 ...md64.yaml => frankenphp-php8.3_amd64.yaml} | 0 ...rm64.yaml => frankenphp-php8.3_arm64.yaml} | 0 ...md64.yaml => frankenphp-php8.4_amd64.yaml} | 0 ...rm64.yaml => frankenphp-php8.4_arm64.yaml} | 0 .../testdata/frankenphp1.5-php8.0_amd64.yaml | 120 ------------------ .../testdata/frankenphp1.5-php8.0_arm64.yaml | 120 ------------------ .../testdata/frankenphp1.5-php8.1_amd64.yaml | 120 ------------------ .../testdata/frankenphp1.5-php8.1_arm64.yaml | 120 ------------------ 11 files changed, 4 insertions(+), 484 deletions(-) rename frankenphp/testdata/{frankenphp1.5-php8.2_amd64.yaml => frankenphp-php8.2_amd64.yaml} (100%) rename frankenphp/testdata/{frankenphp1.5-php8.2_arm64.yaml => frankenphp-php8.2_arm64.yaml} (100%) rename frankenphp/testdata/{frankenphp1.5-php8.3_amd64.yaml => frankenphp-php8.3_amd64.yaml} (100%) rename frankenphp/testdata/{frankenphp1.5-php8.3_arm64.yaml => frankenphp-php8.3_arm64.yaml} (100%) rename frankenphp/testdata/{frankenphp1.5-php8.4_amd64.yaml => frankenphp-php8.4_amd64.yaml} (100%) rename frankenphp/testdata/{frankenphp1.5-php8.4_arm64.yaml => frankenphp-php8.4_arm64.yaml} (100%) delete mode 100644 frankenphp/testdata/frankenphp1.5-php8.0_amd64.yaml delete mode 100644 frankenphp/testdata/frankenphp1.5-php8.0_arm64.yaml delete mode 100644 frankenphp/testdata/frankenphp1.5-php8.1_amd64.yaml delete mode 100644 frankenphp/testdata/frankenphp1.5-php8.1_arm64.yaml diff --git a/frankenphp/BUILD b/frankenphp/BUILD index 47e39bb..3a26940 100644 --- a/frankenphp/BUILD +++ b/frankenphp/BUILD @@ -1,15 +1,15 @@ load("@io_bazel_rules_docker//container:import.bzl", "container_import") load("@io_bazel_rules_docker//contrib:test.bzl", "container_test") -load(":php-arch.bzl", "ARCHITECTURES") -load(":php-version.bzl", "FRANKENPHP_VERSION") +load(":frankenphp-arch.bzl", "ARCHITECTURES") +load(":php-version.bzl", "PHP_VERSION") package(default_visibility = ["//visibility:public"]) [ container_test( - name = "frankenphp" + FRANKENPHP_VERSION + "_" + arch + "_test", + name = "frankenphp-php" + PHP_VERSION + "_" + arch + "_test", size = "medium", - configs = ["testdata/frankenphp" + FRANKENPHP_VERSION + "_" + arch + ".yaml"], + configs = ["testdata/frankenphp-php" + PHP_VERSION + "_" + arch + ".yaml"], image = "@image" + arch + "//image", ) for arch in ARCHITECTURES diff --git a/frankenphp/testdata/frankenphp1.5-php8.2_amd64.yaml b/frankenphp/testdata/frankenphp-php8.2_amd64.yaml similarity index 100% rename from frankenphp/testdata/frankenphp1.5-php8.2_amd64.yaml rename to frankenphp/testdata/frankenphp-php8.2_amd64.yaml diff --git a/frankenphp/testdata/frankenphp1.5-php8.2_arm64.yaml b/frankenphp/testdata/frankenphp-php8.2_arm64.yaml similarity index 100% rename from frankenphp/testdata/frankenphp1.5-php8.2_arm64.yaml rename to frankenphp/testdata/frankenphp-php8.2_arm64.yaml diff --git a/frankenphp/testdata/frankenphp1.5-php8.3_amd64.yaml b/frankenphp/testdata/frankenphp-php8.3_amd64.yaml similarity index 100% rename from frankenphp/testdata/frankenphp1.5-php8.3_amd64.yaml rename to frankenphp/testdata/frankenphp-php8.3_amd64.yaml diff --git a/frankenphp/testdata/frankenphp1.5-php8.3_arm64.yaml b/frankenphp/testdata/frankenphp-php8.3_arm64.yaml similarity index 100% rename from frankenphp/testdata/frankenphp1.5-php8.3_arm64.yaml rename to frankenphp/testdata/frankenphp-php8.3_arm64.yaml diff --git a/frankenphp/testdata/frankenphp1.5-php8.4_amd64.yaml b/frankenphp/testdata/frankenphp-php8.4_amd64.yaml similarity index 100% rename from frankenphp/testdata/frankenphp1.5-php8.4_amd64.yaml rename to frankenphp/testdata/frankenphp-php8.4_amd64.yaml diff --git a/frankenphp/testdata/frankenphp1.5-php8.4_arm64.yaml b/frankenphp/testdata/frankenphp-php8.4_arm64.yaml similarity index 100% rename from frankenphp/testdata/frankenphp1.5-php8.4_arm64.yaml rename to frankenphp/testdata/frankenphp-php8.4_arm64.yaml diff --git a/frankenphp/testdata/frankenphp1.5-php8.0_amd64.yaml b/frankenphp/testdata/frankenphp1.5-php8.0_amd64.yaml deleted file mode 100644 index 4c825e9..0000000 --- a/frankenphp/testdata/frankenphp1.5-php8.0_amd64.yaml +++ /dev/null @@ -1,120 +0,0 @@ -schemaVersion: "1.0.0" -fileExistenceTests: - - name: php-fpm executable - path: '/usr/local/sbin/php-fpm' - shouldExist: true - - name: php executable - path: '/usr/local/bin/php' - shouldExist: true - - name: 'Composer 755' - path: '/usr/bin/composer' - shouldExist: true - permissions: '-rwxr-xr-x' - - name: 'PHP Entry point 775' - path: '/usr/local/bin/docker-php-entrypoint' - shouldExist: true - permissions: '-rwxrwxr-x' -commandTests: - - name: arch - command: [ "uname", "-m" ] - expectedOutput: [ "x86_64" ] - - name: php-fpm version - command: [ "/usr/local/sbin/php-fpm", "--version" ] - expectedOutput: [ "PHP 8.0" ] - - name: php-fpm-modules - command: [ "/usr/local/sbin/php-fpm", "-m" ] - expectedOutput: - - 'apcu' - - 'cgi-fcgi' - - 'Core' - - 'ctype' - - 'curl' - - 'date' - - 'dom' - - 'exif' - - 'fileinfo' - - 'filter' - - 'ftp' - - 'gd' - - 'hash' - - 'iconv' - - 'intl' - - 'json' - - 'libxml' - - 'mbstring' - - 'mysqlnd' - - 'openssl' - - 'pcre' - - 'PDO' - - 'pdo_mysql' - - 'Phar' - - 'posix' - - 'readline' - - 'Reflection' - - 'session' - - 'SimpleXML' - - 'sodium' - - 'SPL' - - 'standard' - - 'tokenizer' - - 'xml' - - 'xmlreader' - - 'xmlwriter' - - 'Zend OPcache' - - 'zip' - - 'zlib' - - name: php-cli version - command: [ "/usr/local/bin/php", "--version" ] - expectedOutput: [ "PHP 8.0" ] - - name: config-files - command: [ "/usr/local/bin/php", "--ini" ] - expectedOutput: - - '/usr/local/etc/php/conf.d/docker-php-ext-apcu.ini' - - '/usr/local/etc/php/conf.d/docker-php-ext-exif.ini' - - '/usr/local/etc/php/conf.d/docker-php-ext-gd.ini' - - '/usr/local/etc/php/conf.d/docker-php-ext-intl.ini' - - '/usr/local/etc/php/conf.d/docker-php-ext-opcache.ini' - - '/usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini' - - '/usr/local/etc/php/conf.d/docker-php-ext-sodium.ini' - - '/usr/local/etc/php/conf.d/docker-php-ext-zip.ini' - - name: php-cli extensions - command: [ "/usr/local/bin/php", "-m" ] - expectedOutput: - - 'apcu' - - 'Core' - - 'ctype' - - 'curl' - - 'date' - - 'dom' - - 'exif' - - 'fileinfo' - - 'filter' - - 'ftp' - - 'gd' - - 'hash' - - 'iconv' - - 'intl' - - 'json' - - 'libxml' - - 'mbstring' - - 'mysqlnd' - - 'openssl' - - 'pcre' - - 'PDO' - - 'pdo_mysql' - - 'Phar' - - 'posix' - - 'readline' - - 'Reflection' - - 'session' - - 'SimpleXML' - - 'sodium' - - 'SPL' - - 'standard' - - 'tokenizer' - - 'xml' - - 'xmlreader' - - 'xmlwriter' - - 'Zend OPcache' - - 'zip' - - 'zlib' diff --git a/frankenphp/testdata/frankenphp1.5-php8.0_arm64.yaml b/frankenphp/testdata/frankenphp1.5-php8.0_arm64.yaml deleted file mode 100644 index 2727d53..0000000 --- a/frankenphp/testdata/frankenphp1.5-php8.0_arm64.yaml +++ /dev/null @@ -1,120 +0,0 @@ -schemaVersion: "1.0.0" -fileExistenceTests: - - name: php-fpm executable - path: '/usr/local/sbin/php-fpm' - shouldExist: true - - name: php executable - path: '/usr/local/bin/php' - shouldExist: true - - name: 'Composer 755' - path: '/usr/bin/composer' - shouldExist: true - permissions: '-rwxr-xr-x' - - name: 'PHP Entry point 775' - path: '/usr/local/bin/docker-php-entrypoint' - shouldExist: true - permissions: '-rwxrwxr-x' -commandTests: - - name: arch - command: [ "uname", "-m" ] - expectedOutput: [ "aarch64" ] - - name: php-fpm version - command: [ "/usr/local/sbin/php-fpm", "--version" ] - expectedOutput: [ "PHP 8.0" ] - - name: php-fpm-modules - command: [ "/usr/local/sbin/php-fpm", "-m" ] - expectedOutput: - - 'apcu' - - 'cgi-fcgi' - - 'Core' - - 'ctype' - - 'curl' - - 'date' - - 'dom' - - 'exif' - - 'fileinfo' - - 'filter' - - 'ftp' - - 'gd' - - 'hash' - - 'iconv' - - 'intl' - - 'json' - - 'libxml' - - 'mbstring' - - 'mysqlnd' - - 'openssl' - - 'pcre' - - 'PDO' - - 'pdo_mysql' - - 'Phar' - - 'posix' - - 'readline' - - 'Reflection' - - 'session' - - 'SimpleXML' - - 'sodium' - - 'SPL' - - 'standard' - - 'tokenizer' - - 'xml' - - 'xmlreader' - - 'xmlwriter' - - 'Zend OPcache' - - 'zip' - - 'zlib' - - name: php-cli version - command: [ "/usr/local/bin/php", "--version" ] - expectedOutput: [ "PHP 8.0" ] - - name: config-files - command: [ "/usr/local/bin/php", "--ini" ] - expectedOutput: - - '/usr/local/etc/php/conf.d/docker-php-ext-apcu.ini' - - '/usr/local/etc/php/conf.d/docker-php-ext-exif.ini' - - '/usr/local/etc/php/conf.d/docker-php-ext-gd.ini' - - '/usr/local/etc/php/conf.d/docker-php-ext-intl.ini' - - '/usr/local/etc/php/conf.d/docker-php-ext-opcache.ini' - - '/usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini' - - '/usr/local/etc/php/conf.d/docker-php-ext-sodium.ini' - - '/usr/local/etc/php/conf.d/docker-php-ext-zip.ini' - - name: php-cli extensions - command: [ "/usr/local/bin/php", "-m" ] - expectedOutput: - - 'apcu' - - 'Core' - - 'ctype' - - 'curl' - - 'date' - - 'dom' - - 'exif' - - 'fileinfo' - - 'filter' - - 'ftp' - - 'gd' - - 'hash' - - 'iconv' - - 'intl' - - 'json' - - 'libxml' - - 'mbstring' - - 'mysqlnd' - - 'openssl' - - 'pcre' - - 'PDO' - - 'pdo_mysql' - - 'Phar' - - 'posix' - - 'readline' - - 'Reflection' - - 'session' - - 'SimpleXML' - - 'sodium' - - 'SPL' - - 'standard' - - 'tokenizer' - - 'xml' - - 'xmlreader' - - 'xmlwriter' - - 'Zend OPcache' - - 'zip' - - 'zlib' diff --git a/frankenphp/testdata/frankenphp1.5-php8.1_amd64.yaml b/frankenphp/testdata/frankenphp1.5-php8.1_amd64.yaml deleted file mode 100644 index 9e3faeb..0000000 --- a/frankenphp/testdata/frankenphp1.5-php8.1_amd64.yaml +++ /dev/null @@ -1,120 +0,0 @@ -schemaVersion: "1.0.0" -fileExistenceTests: - - name: php-fpm executable - path: '/usr/local/sbin/php-fpm' - shouldExist: true - - name: php executable - path: '/usr/local/bin/php' - shouldExist: true - - name: 'Composer 755' - path: '/usr/bin/composer' - shouldExist: true - permissions: '-rwxr-xr-x' - - name: 'PHP Entry point 755' - path: '/usr/local/bin/docker-php-entrypoint' - shouldExist: true - permissions: '-rwxr-xr-x' -commandTests: - - name: arch - command: [ "uname", "-m" ] - expectedOutput: [ "x86_64" ] - - name: php-fpm version - command: [ "/usr/local/sbin/php-fpm", "--version" ] - expectedOutput: [ "PHP 8.1" ] - - name: php-fpm-modules - command: [ "/usr/local/sbin/php-fpm", "-m" ] - expectedOutput: - - 'apcu' - - 'cgi-fcgi' - - 'Core' - - 'ctype' - - 'curl' - - 'date' - - 'dom' - - 'exif' - - 'fileinfo' - - 'filter' - - 'ftp' - - 'gd' - - 'hash' - - 'iconv' - - 'intl' - - 'json' - - 'libxml' - - 'mbstring' - - 'mysqlnd' - - 'openssl' - - 'pcre' - - 'PDO' - - 'pdo_mysql' - - 'Phar' - - 'posix' - - 'readline' - - 'Reflection' - - 'session' - - 'SimpleXML' - - 'sodium' - - 'SPL' - - 'standard' - - 'tokenizer' - - 'xml' - - 'xmlreader' - - 'xmlwriter' - - 'Zend OPcache' - - 'zip' - - 'zlib' - - name: php-cli version - command: [ "/usr/local/bin/php", "--version" ] - expectedOutput: [ "PHP 8.1" ] - - name: config-files - command: [ "/usr/local/bin/php", "--ini" ] - expectedOutput: - - '/usr/local/etc/php/conf.d/docker-php-ext-apcu.ini' - - '/usr/local/etc/php/conf.d/docker-php-ext-exif.ini' - - '/usr/local/etc/php/conf.d/docker-php-ext-gd.ini' - - '/usr/local/etc/php/conf.d/docker-php-ext-intl.ini' - - '/usr/local/etc/php/conf.d/docker-php-ext-opcache.ini' - - '/usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini' - - '/usr/local/etc/php/conf.d/docker-php-ext-sodium.ini' - - '/usr/local/etc/php/conf.d/docker-php-ext-zip.ini' - - name: php-cli extensions - command: [ "/usr/local/bin/php", "-m" ] - expectedOutput: - - 'apcu' - - 'Core' - - 'ctype' - - 'curl' - - 'date' - - 'dom' - - 'exif' - - 'fileinfo' - - 'filter' - - 'ftp' - - 'gd' - - 'hash' - - 'iconv' - - 'intl' - - 'json' - - 'libxml' - - 'mbstring' - - 'mysqlnd' - - 'openssl' - - 'pcre' - - 'PDO' - - 'pdo_mysql' - - 'Phar' - - 'posix' - - 'readline' - - 'Reflection' - - 'session' - - 'SimpleXML' - - 'sodium' - - 'SPL' - - 'standard' - - 'tokenizer' - - 'xml' - - 'xmlreader' - - 'xmlwriter' - - 'Zend OPcache' - - 'zip' - - 'zlib' diff --git a/frankenphp/testdata/frankenphp1.5-php8.1_arm64.yaml b/frankenphp/testdata/frankenphp1.5-php8.1_arm64.yaml deleted file mode 100644 index 99fda77..0000000 --- a/frankenphp/testdata/frankenphp1.5-php8.1_arm64.yaml +++ /dev/null @@ -1,120 +0,0 @@ -schemaVersion: "1.0.0" -fileExistenceTests: - - name: php-fpm executable - path: '/usr/local/sbin/php-fpm' - shouldExist: true - - name: php executable - path: '/usr/local/bin/php' - shouldExist: true - - name: 'Composer 755' - path: '/usr/bin/composer' - shouldExist: true - permissions: '-rwxr-xr-x' - - name: 'PHP Entry point 755' - path: '/usr/local/bin/docker-php-entrypoint' - shouldExist: true - permissions: '-rwxr-xr-x' -commandTests: - - name: arch - command: [ "uname", "-m" ] - expectedOutput: [ "aarch64" ] - - name: php-fpm version - command: [ "/usr/local/sbin/php-fpm", "--version" ] - expectedOutput: [ "PHP 8.1" ] - - name: php-fpm-modules - command: [ "/usr/local/sbin/php-fpm", "-m" ] - expectedOutput: - - 'apcu' - - 'cgi-fcgi' - - 'Core' - - 'ctype' - - 'curl' - - 'date' - - 'dom' - - 'exif' - - 'fileinfo' - - 'filter' - - 'ftp' - - 'gd' - - 'hash' - - 'iconv' - - 'intl' - - 'json' - - 'libxml' - - 'mbstring' - - 'mysqlnd' - - 'openssl' - - 'pcre' - - 'PDO' - - 'pdo_mysql' - - 'Phar' - - 'posix' - - 'readline' - - 'Reflection' - - 'session' - - 'SimpleXML' - - 'sodium' - - 'SPL' - - 'standard' - - 'tokenizer' - - 'xml' - - 'xmlreader' - - 'xmlwriter' - - 'Zend OPcache' - - 'zip' - - 'zlib' - - name: php-cli version - command: [ "/usr/local/bin/php", "--version" ] - expectedOutput: [ "PHP 8.1" ] - - name: config-files - command: [ "/usr/local/bin/php", "--ini" ] - expectedOutput: - - '/usr/local/etc/php/conf.d/docker-php-ext-apcu.ini' - - '/usr/local/etc/php/conf.d/docker-php-ext-exif.ini' - - '/usr/local/etc/php/conf.d/docker-php-ext-gd.ini' - - '/usr/local/etc/php/conf.d/docker-php-ext-intl.ini' - - '/usr/local/etc/php/conf.d/docker-php-ext-opcache.ini' - - '/usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini' - - '/usr/local/etc/php/conf.d/docker-php-ext-sodium.ini' - - '/usr/local/etc/php/conf.d/docker-php-ext-zip.ini' - - name: php-cli extensions - command: [ "/usr/local/bin/php", "-m" ] - expectedOutput: - - 'apcu' - - 'Core' - - 'ctype' - - 'curl' - - 'date' - - 'dom' - - 'exif' - - 'fileinfo' - - 'filter' - - 'ftp' - - 'gd' - - 'hash' - - 'iconv' - - 'intl' - - 'json' - - 'libxml' - - 'mbstring' - - 'mysqlnd' - - 'openssl' - - 'pcre' - - 'PDO' - - 'pdo_mysql' - - 'Phar' - - 'posix' - - 'readline' - - 'Reflection' - - 'session' - - 'SimpleXML' - - 'sodium' - - 'SPL' - - 'standard' - - 'tokenizer' - - 'xml' - - 'xmlreader' - - 'xmlwriter' - - 'Zend OPcache' - - 'zip' - - 'zlib' From e84d68e7e6b8ea6406f83bb242fee4d16c33bdd4 Mon Sep 17 00:00:00 2001 From: Francis Hilaire Date: Sun, 30 Mar 2025 19:26:42 +0200 Subject: [PATCH 21/43] Remove not required yet fixuid image --- frankenphp/fixuid.Dockerfile | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 frankenphp/fixuid.Dockerfile diff --git a/frankenphp/fixuid.Dockerfile b/frankenphp/fixuid.Dockerfile deleted file mode 100644 index af50492..0000000 --- a/frankenphp/fixuid.Dockerfile +++ /dev/null @@ -1,30 +0,0 @@ -ARG IMAGE_NAME -ARG IMAGE_TAG -ARG FIXUID_VERSION=0.6.0 - -FROM ${IMAGE_NAME}:${IMAGE_TAG} - -ARG FIXUID_VERSION - -RUN addgroup -g 1000 sylius && \ - adduser -u 1000 -G sylius -h /home/sylius -s /bin/sh -D sylius - -RUN USER=sylius && \ - GROUP=sylius && \ - if [[ "$(uname -m)" = "aarch64" ]] ; \ - then \ - curl -SsL https://github.com/boxboat/fixuid/releases/download/v${FIXUID_VERSION}/fixuid-${FIXUID_VERSION}-linux-arm64.tar.gz | tar -C /usr/local/bin -xzf - ;\ - else \ - curl -SsL https://github.com/boxboat/fixuid/releases/download/v${FIXUID_VERSION}/fixuid-${FIXUID_VERSION}-linux-amd64.tar.gz | tar -C /usr/local/bin -xzf - ;\ - fi; \ - chown root:root /usr/local/bin/fixuid && \ - chmod 4755 /usr/local/bin/fixuid && \ - mkdir -p /etc/fixuid && \ - printf "user: $USER\ngroup: $GROUP\n" > /etc/fixuid/config.yml && \ - # Modify FrankenPHP entrypoint to use fixuid - sed -i 's/^set -e.*/set -e\nfixuid/g' /usr/local/bin/docker-php-entrypoint - -# Fix permissions during named volume creation -RUN mkdir -p /srv/sylius/public/media && chmod 777 -R /srv/sylius - -USER sylius:sylius \ No newline at end of file From 607753b17c1dcb18a86cc626e4d43748f4285eef Mon Sep 17 00:00:00 2001 From: Francis Hilaire Date: Sun, 30 Mar 2025 19:27:26 +0200 Subject: [PATCH 22/43] Copy from PHP image the used exts --- frankenphp/Dockerfile | 59 +++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/frankenphp/Dockerfile b/frankenphp/Dockerfile index 978c387..2ca4dde 100644 --- a/frankenphp/Dockerfile +++ b/frankenphp/Dockerfile @@ -1,5 +1,5 @@ #syntax=docker/dockerfile:1 -ARG FRANKENPHP_VERSION=1.5-php8.2 +ARG FRANKENPHP_VERSION=1.5-php8.2-alpine # Adapted from https://github.com/dunglas/symfony-docker @@ -17,41 +17,40 @@ FROM frankenphp_upstream AS frankenphp_base WORKDIR /srv/sylius +# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser +ENV COMPOSER_ALLOW_SUPERUSER=1 + # persistent / runtime deps # hadolint ignore=DL3008 -RUN if [ "$(awk -F= '/^NAME/{print $2}' /etc/os-release)" = '"Ubuntu"' ]; then \ - apt-get update \ - && apt-get install --no-install-recommends -y \ +RUN set -eux; \ + apk add --no-cache --virtual .build-deps \ + $PHPIZE_DEPS \ + linux-headers \ + freetype-dev \ + icu-dev \ + libjpeg-turbo-dev \ + libpng-dev \ + libtool \ + libwebp-dev \ + libzip-dev \ + zlib-dev \ + && apk add --no-cache --virtual .persistent-deps \ acl \ file \ - gettext \ git \ - && rm -rf /var/lib/apt/lists/*; \ -fi -RUN if [ "$(awk -F= '/^NAME/{print $2}' /etc/os-release)" = '"Alpine Linux"' ]; then \ - apk add --no-cache --virtual .build-deps $PHPIZE_DEPS linux-headers \ - && apk add --no-cache \ - acl \ - file \ gettext \ - git \ - && apk del .build-deps; \ -fi - -# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser -ENV COMPOSER_ALLOW_SUPERUSER=1 - -RUN set -eux; \ - install-php-extensions \ - @composer \ - apcu \ - intl \ - opcache \ - zip \ - ; - -RUN set -eux; \ - install-php-extensions pdo_pgsql pdo_mysql pdo_sqlite + gnu-libiconv \ + nss-tools \ + && install-php-extensions \ + @composer \ + apcu \ + exif \ + gd \ + intl \ + pdo_mysql \ + opcache \ + zip \ + && apk del --no-network .build-deps COPY --link conf.d/app.ini $PHP_INI_DIR/conf.d/ COPY --link --chmod=755 docker-entrypoint.sh /usr/local/bin/docker-entrypoint From ff9e19af516c6fc6845882a642cf635be352cce7 Mon Sep 17 00:00:00 2001 From: Francis Hilaire Date: Sun, 30 Mar 2025 19:48:45 +0200 Subject: [PATCH 23/43] Refactor xdebug build/image --- .github/workflows/sylius-frankenphp.yml | 8 -------- frankenphp/xdebug.Dockerfile | 25 ++++++------------------- 2 files changed, 6 insertions(+), 27 deletions(-) diff --git a/.github/workflows/sylius-frankenphp.yml b/.github/workflows/sylius-frankenphp.yml index 46116e2..fb527b1 100644 --- a/.github/workflows/sylius-frankenphp.yml +++ b/.github/workflows/sylius-frankenphp.yml @@ -217,13 +217,6 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} logout: true - - name: Prepare variable names for Docker build - id: docker-build-variable-names - run: | - PHP_VERSION="${{ matrix.php }}" - PHP_XDEBUG_VERSION_VARIABLE=XDEBUG_VERSION_PHP_${PHP_VERSION//./_} - echo "XDEBUG_VERSION=$(jq -r --arg PHP_XDEBUG_VERSION_VARIABLE "$PHP_XDEBUG_VERSION_VARIABLE" '.[$PHP_XDEBUG_VERSION_VARIABLE]' <<< '${{ toJSON(vars) }}')" >> $GITHUB_ENV - - name: Build and push uses: docker/build-push-action@v5 with: @@ -232,7 +225,6 @@ jobs: build-args: | "IMAGE_NAME=${{ vars.DOCKER_FRANKENPHP_REPOSITORY_NAME }}" "IMAGE_TAG=${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}" - "XDEBUG_VERSION=${{ env.XDEBUG_VERSION }}" platforms: linux/amd64,linux/arm64 push: ${{ github.ref == 'refs/heads/frankenphp' || github.ref == 'refs/heads/main' || github.event_name == 'release' }} pull: true diff --git a/frankenphp/xdebug.Dockerfile b/frankenphp/xdebug.Dockerfile index 89d2f18..478e965 100644 --- a/frankenphp/xdebug.Dockerfile +++ b/frankenphp/xdebug.Dockerfile @@ -1,24 +1,11 @@ ARG IMAGE_NAME ARG IMAGE_TAG -ARG XDEBUG_VERSION=3.1.2 - FROM ${IMAGE_NAME}:${IMAGE_TAG} -ARG XDEBUG_VERSION - -RUN if [ "$(awk -F= '/^NAME/{print $2}' /etc/os-release)" = '"Ubuntu"' ] then \ - set -eux \ - && apt install build-essentials \ - && pecl install xdebug-$XDEBUG_VERSION \ - && docker-php-ext-enable xdebug \ - && apt autoclean; \ -fi - -RUN if [ "$(awk -F= '/^NAME/{print $2}' /etc/os-release)" = '"Alpine Linux"' ] then \ - set -eux \ - && apk add --no-cache --virtual .build-deps $PHPIZE_DEPS linux-headers \ - && pecl install xdebug-$XDEBUG_VERSION \ - && docker-php-ext-enable xdebug \ - && apk del .build-deps; \ -fi +RUN set -eux; \ + apk add --no-cache --virtual .build-deps \ + $PHPIZE_DEPS \ + && install-php-extensions \ + xdebug \ + && apk del --no-network .build-deps From 8a087fdbac0d17acf8d13af2cf45a0ce4bef192d Mon Sep 17 00:00:00 2001 From: Francis Hilaire Date: Sun, 30 Mar 2025 19:56:39 +0200 Subject: [PATCH 24/43] Simplify build like FrankenPHP doc is telling us to do it --- frankenphp/Dockerfile | 38 +++++++++--------------------------- frankenphp/xdebug.Dockerfile | 7 +------ 2 files changed, 10 insertions(+), 35 deletions(-) diff --git a/frankenphp/Dockerfile b/frankenphp/Dockerfile index 2ca4dde..fc83eba 100644 --- a/frankenphp/Dockerfile +++ b/frankenphp/Dockerfile @@ -22,35 +22,15 @@ ENV COMPOSER_ALLOW_SUPERUSER=1 # persistent / runtime deps # hadolint ignore=DL3008 -RUN set -eux; \ - apk add --no-cache --virtual .build-deps \ - $PHPIZE_DEPS \ - linux-headers \ - freetype-dev \ - icu-dev \ - libjpeg-turbo-dev \ - libpng-dev \ - libtool \ - libwebp-dev \ - libzip-dev \ - zlib-dev \ - && apk add --no-cache --virtual .persistent-deps \ - acl \ - file \ - git \ - gettext \ - gnu-libiconv \ - nss-tools \ - && install-php-extensions \ - @composer \ - apcu \ - exif \ - gd \ - intl \ - pdo_mysql \ - opcache \ - zip \ - && apk del --no-network .build-deps +RUN install-php-extensions \ + @composer \ + apcu \ + exif \ + gd \ + intl \ + pdo_mysql \ + opcache \ + zip COPY --link conf.d/app.ini $PHP_INI_DIR/conf.d/ COPY --link --chmod=755 docker-entrypoint.sh /usr/local/bin/docker-entrypoint diff --git a/frankenphp/xdebug.Dockerfile b/frankenphp/xdebug.Dockerfile index 478e965..6992259 100644 --- a/frankenphp/xdebug.Dockerfile +++ b/frankenphp/xdebug.Dockerfile @@ -3,9 +3,4 @@ ARG IMAGE_TAG FROM ${IMAGE_NAME}:${IMAGE_TAG} -RUN set -eux; \ - apk add --no-cache --virtual .build-deps \ - $PHPIZE_DEPS \ - && install-php-extensions \ - xdebug \ - && apk del --no-network .build-deps +RUN install-php-extensions xdebug From 3440d8f2128eac8474465e1a899f7559e6c15bae Mon Sep 17 00:00:00 2001 From: Francis Hilaire Date: Sun, 30 Mar 2025 19:58:09 +0200 Subject: [PATCH 25/43] Remove opcache preload since no source are available yet --- frankenphp/conf.d/app.prod.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/frankenphp/conf.d/app.prod.ini b/frankenphp/conf.d/app.prod.ini index 3bcaa71..4df4f62 100644 --- a/frankenphp/conf.d/app.prod.ini +++ b/frankenphp/conf.d/app.prod.ini @@ -1,2 +1 @@ opcache.preload_user = root -opcache.preload = /app/config/preload.php From cbd1fab2bfb04b8a349a06b030548af2e96051a7 Mon Sep 17 00:00:00 2001 From: Mathieu Ledru Date: Sun, 30 Mar 2025 22:28:14 +0200 Subject: [PATCH 26/43] Refactor build --- .github/workflows/sylius-frankenphp.yml | 33 ++++++++----------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/.github/workflows/sylius-frankenphp.yml b/.github/workflows/sylius-frankenphp.yml index 73ca031..eb7cbd0 100644 --- a/.github/workflows/sylius-frankenphp.yml +++ b/.github/workflows/sylius-frankenphp.yml @@ -54,7 +54,7 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Cache Docker layers - uses: actions/cache@v4 + uses: actions/cache@v4.0.0 with: path: /tmp/.buildx-cache key: "${{ runner.os }}-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-buildx-cache-${{ vars.CACHE_VERSION }}-${{ steps.generate-uuid.outputs.uuid }}" @@ -63,21 +63,22 @@ jobs: restore-keys: "${{ runner.os }}-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-buildx-cache-${{ vars.CACHE_VERSION }}-" - name: Docker Login - uses: docker/login-action@v3 + uses: docker/login-action@v3.0.0 with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + registry: ${{ secrets.DOCKER_REGISTRY }} + username: ${{ secrets.DOCKER_REPOSITORY_LOGIN }} + password: ${{ secrets.DOCKER_REPOSITORY_PASSWORD }} logout: true - - name: Build multiplatform - uses: docker/build-push-action@v5 + - name: Build and push + uses: docker/build-push-action@v5.0.0 with: file: ./frankenphp/Dockerfile context: ./frankenphp - build-args: "FRANKENPHP_VERSION=${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}" + build-args: | + "FRANKENPHP_VERSION=${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}" platforms: linux/amd64,linux/arm64 - push: false + push: ${{ github.ref == 'refs/heads/frankenphp' || github.event_name == 'workflow_dispatch' }} pull: true tags: ${{ steps.meta.outputs.tags }} cache-from: type=local,src=/tmp/.buildx-cache @@ -135,20 +136,6 @@ jobs: bazel build --curses=no ${targets} bazel test --curses=no --test_output=errors ${targets} - - name: Push - uses: docker/build-push-action@v5 - with: - file: ./frankenphp/Dockerfile - context: ./frankenphp - build-args: "FRANKENPHP_VERSION=${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}" - platforms: linux/amd64,linux/arm64 - push: ${{ github.ref == 'refs/heads/frankenphp' || github.ref == 'refs/heads/main' || github.event_name == 'release' }} - pull: false - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=local,src=/tmp/.buildx-cache-new - cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new - - name: Move cache run: | rm -rf /tmp/.buildx-cache From a3b35f645d6025f17abf107abd86bee1136086d8 Mon Sep 17 00:00:00 2001 From: Mathieu Ledru Date: Sun, 30 Mar 2025 22:31:12 +0200 Subject: [PATCH 27/43] Update platform specific deps --- frankenphp/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frankenphp/Dockerfile b/frankenphp/Dockerfile index ae5852c..238cad6 100644 --- a/frankenphp/Dockerfile +++ b/frankenphp/Dockerfile @@ -19,7 +19,7 @@ WORKDIR /srv/sylius # persistent / runtime deps # hadolint ignore=DL3008 -RUN if [ "$(awk -F= '/^NAME/{print $2}' /etc/os-release)" = '"Ubuntu"' ]; then \ +RUN if grep -q "Ubuntu" /etc/os-release; then \ apt-get update \ && apt-get install --no-install-recommends -y \ acl \ @@ -28,8 +28,7 @@ RUN if [ "$(awk -F= '/^NAME/{print $2}' /etc/os-release)" = '"Ubuntu"' ]; then \ git \ libnss3-tools \ && rm -rf /var/lib/apt/lists/*; \ -fi -RUN if [ "$(awk -F= '/^NAME/{print $2}' /etc/os-release)" = '"Alpine Linux"' ]; then \ +elif grep -q "Alpine Linux" /etc/os-release; then \ apk add --no-cache --virtual .build-deps $PHPIZE_DEPS linux-headers \ && apk add --no-cache \ acl \ @@ -37,6 +36,7 @@ RUN if [ "$(awk -F= '/^NAME/{print $2}' /etc/os-release)" = '"Alpine Linux"' ]; gettext \ git \ nss-tools \ + curl \ && apk del .build-deps; \ fi From 48e9fc6e3c43b5162f071e549d1b9186c8822cc2 Mon Sep 17 00:00:00 2001 From: Mathieu Ledru Date: Sun, 30 Mar 2025 22:32:41 +0200 Subject: [PATCH 28/43] Fix action cache version --- .github/workflows/sylius-frankenphp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sylius-frankenphp.yml b/.github/workflows/sylius-frankenphp.yml index eb7cbd0..23e9252 100644 --- a/.github/workflows/sylius-frankenphp.yml +++ b/.github/workflows/sylius-frankenphp.yml @@ -54,7 +54,7 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Cache Docker layers - uses: actions/cache@v4.0.0 + uses: actions/cache@v4 with: path: /tmp/.buildx-cache key: "${{ runner.os }}-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-buildx-cache-${{ vars.CACHE_VERSION }}-${{ steps.generate-uuid.outputs.uuid }}" From 49ce144c4b37eb66965cd6ba77e02673433eb9aa Mon Sep 17 00:00:00 2001 From: Mathieu Ledru Date: Sun, 30 Mar 2025 22:35:04 +0200 Subject: [PATCH 29/43] force build image --- .github/workflows/sylius-frankenphp.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/sylius-frankenphp.yml b/.github/workflows/sylius-frankenphp.yml index 23e9252..7d18bd9 100644 --- a/.github/workflows/sylius-frankenphp.yml +++ b/.github/workflows/sylius-frankenphp.yml @@ -3,12 +3,8 @@ name: PHP Docker Image CI for Sylius on: workflow_dispatch: ~ push: - branches: [ frankenphp ] - paths: - - 'frankenphp/**' - - 'WORKSPACE' - schedule: - - cron: '0 20 * * 5' + branches: + - frankenphp jobs: From 454757d5f4189835f1b22dd3469aa8bfbf7271d8 Mon Sep 17 00:00:00 2001 From: Mathieu Ledru Date: Sun, 30 Mar 2025 22:35:37 +0200 Subject: [PATCH 30/43] Rollback force build image --- .github/workflows/sylius-frankenphp.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sylius-frankenphp.yml b/.github/workflows/sylius-frankenphp.yml index 7d18bd9..23e9252 100644 --- a/.github/workflows/sylius-frankenphp.yml +++ b/.github/workflows/sylius-frankenphp.yml @@ -3,8 +3,12 @@ name: PHP Docker Image CI for Sylius on: workflow_dispatch: ~ push: - branches: - - frankenphp + branches: [ frankenphp ] + paths: + - 'frankenphp/**' + - 'WORKSPACE' + schedule: + - cron: '0 20 * * 5' jobs: From 9cb9149130e38834749bb08206837bf48d1bed46 Mon Sep 17 00:00:00 2001 From: Mathieu Ledru Date: Sun, 30 Mar 2025 22:38:24 +0200 Subject: [PATCH 31/43] fix docker login --- .github/workflows/sylius-frankenphp.yml | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/.github/workflows/sylius-frankenphp.yml b/.github/workflows/sylius-frankenphp.yml index 23e9252..b3cac88 100644 --- a/.github/workflows/sylius-frankenphp.yml +++ b/.github/workflows/sylius-frankenphp.yml @@ -3,12 +3,8 @@ name: PHP Docker Image CI for Sylius on: workflow_dispatch: ~ push: - branches: [ frankenphp ] - paths: - - 'frankenphp/**' - - 'WORKSPACE' - schedule: - - cron: '0 20 * * 5' + branches: + - frankenphp jobs: @@ -63,11 +59,11 @@ jobs: restore-keys: "${{ runner.os }}-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-buildx-cache-${{ vars.CACHE_VERSION }}-" - name: Docker Login - uses: docker/login-action@v3.0.0 + uses: docker/login-action@v3 with: - registry: ${{ secrets.DOCKER_REGISTRY }} - username: ${{ secrets.DOCKER_REPOSITORY_LOGIN }} - password: ${{ secrets.DOCKER_REPOSITORY_PASSWORD }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} logout: true - name: Build and push From b7d6b4867e4cdb413f2bf7991b773ee620e15899 Mon Sep 17 00:00:00 2001 From: Mathieu Ledru Date: Sun, 30 Mar 2025 23:11:20 +0200 Subject: [PATCH 32/43] disable bazel for build --- .github/workflows/sylius-frankenphp.yml | 46 ++++++++++++------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/.github/workflows/sylius-frankenphp.yml b/.github/workflows/sylius-frankenphp.yml index b3cac88..5886863 100644 --- a/.github/workflows/sylius-frankenphp.yml +++ b/.github/workflows/sylius-frankenphp.yml @@ -108,29 +108,29 @@ jobs: cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new-arm64 outputs: type=docker,dest=./external/image-arm64.tar - - name: Mount Bazel cache - uses: actions/cache@v4 - with: - path: "~/.cache/bazel" - key: "${{ runner.os }}-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-bazel-cache-${{ vars.CACHE_VERSION }}-${{ steps.generate-uuid.outputs.uuid }}" - restore-keys: "${{ runner.os }}-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-bazel-cache-${{ vars.CACHE_VERSION }}-" - - - name: Setup PHP for Bazel - run: | - set -ex - cat > frankenphp/php-version.bzl < frankenphp/frankenphp-arch.bzl < frankenphp/php-version.bzl < frankenphp/frankenphp-arch.bzl < Date: Mon, 31 Mar 2025 00:25:19 +0200 Subject: [PATCH 33/43] No PWA --- frankenphp/Caddyfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frankenphp/Caddyfile b/frankenphp/Caddyfile index bd6baa9..7404f82 100644 --- a/frankenphp/Caddyfile +++ b/frankenphp/Caddyfile @@ -57,7 +57,7 @@ # Comment the following line if you don't want Next.js to catch requests for HTML documents. # In this case, they will be handled by the PHP app. - reverse_proxy @pwa http://{$PWA_UPSTREAM} + # reverse_proxy @pwa http://{$PWA_UPSTREAM} php_server } From ead9fce7059ab661baf8c284d9f2c356d921d042 Mon Sep 17 00:00:00 2001 From: Mathieu Ledru Date: Mon, 31 Mar 2025 00:57:49 +0200 Subject: [PATCH 34/43] Change root directory --- frankenphp/Caddyfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frankenphp/Caddyfile b/frankenphp/Caddyfile index 7404f82..e6ee872 100644 --- a/frankenphp/Caddyfile +++ b/frankenphp/Caddyfile @@ -18,7 +18,7 @@ } } - root * /app/public + root * /srv/sylius/public encode zstd br gzip mercure { From 39ea03f2fc344e647186f4ab5451efecb670fad6 Mon Sep 17 00:00:00 2001 From: Francis Hilaire Date: Tue, 1 Apr 2025 23:38:30 +0200 Subject: [PATCH 35/43] Remove no more required file and clean configurations --- .github/workflows/sylius-frankenphp.yml | 138 +++++++----------------- frankenphp/Caddyfile | 46 -------- frankenphp/Dockerfile | 38 +------ frankenphp/conf.d/app.dev.ini | 5 + frankenphp/docker-entrypoint.sh | 40 ------- frankenphp/xdebug.Dockerfile | 6 -- 6 files changed, 48 insertions(+), 225 deletions(-) create mode 100644 frankenphp/conf.d/app.dev.ini delete mode 100644 frankenphp/docker-entrypoint.sh delete mode 100644 frankenphp/xdebug.Dockerfile diff --git a/.github/workflows/sylius-frankenphp.yml b/.github/workflows/sylius-frankenphp.yml index 5886863..46a355a 100644 --- a/.github/workflows/sylius-frankenphp.yml +++ b/.github/workflows/sylius-frankenphp.yml @@ -3,8 +3,16 @@ name: PHP Docker Image CI for Sylius on: workflow_dispatch: ~ push: - branches: - - frankenphp + branches: [ frankenphp ] + paths: + - 'frankenphp/**' + - 'WORKSPACE' + schedule: + - cron: '0 20 * * 5' + +concurrency: + group: sylius_frankenphp_build + cancel-in-progress: false jobs: @@ -66,15 +74,14 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} logout: true - - name: Build and push - uses: docker/build-push-action@v5.0.0 + - name: Build multiplatform + uses: docker/build-push-action@v5 with: file: ./frankenphp/Dockerfile context: ./frankenphp - build-args: | - "FRANKENPHP_VERSION=${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}" + build-args: "FRANKENPHP_VERSION=${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}" platforms: linux/amd64,linux/arm64 - push: ${{ github.ref == 'refs/heads/frankenphp' || github.event_name == 'workflow_dispatch' }} + push: false pull: true tags: ${{ steps.meta.outputs.tags }} cache-from: type=local,src=/tmp/.buildx-cache @@ -108,107 +115,42 @@ jobs: cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new-arm64 outputs: type=docker,dest=./external/image-arm64.tar -# - name: Mount Bazel cache -# uses: actions/cache@v4 -# with: -# path: "~/.cache/bazel" -# key: "${{ runner.os }}-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-bazel-cache-${{ vars.CACHE_VERSION }}-${{ steps.generate-uuid.outputs.uuid }}" -# restore-keys: "${{ runner.os }}-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-bazel-cache-${{ vars.CACHE_VERSION }}-" - -# - name: Setup PHP for Bazel -# run: | -# set -ex -# cat > frankenphp/php-version.bzl < frankenphp/frankenphp-arch.bzl <> $GITHUB_OUTPUT - - - name: Set up QEMU - id: qemu - uses: docker/setup-qemu-action@v3 - - - name: Available platforms - run: echo ${{ steps.qemu.outputs.platforms }} - - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ vars.DOCKER_FRANKENPHP_REPOSITORY_NAME }} - tags: | - type=raw,value=${{ matrix.frankenphp }}${{ matrix.php }}-xdebug-${{ matrix.distro }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Cache Docker layers + - name: Mount Bazel cache uses: actions/cache@v4 with: - path: /tmp/.buildx-cache - key: "${{ runner.os }}-frankenphp-xdebug-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-buildx-cache-${{ vars.CACHE_VERSION }}-${{ steps.generate-uuid.outputs.uuid }}" - # https://github.com/actions/cache/issues/109#issuecomment-558771281 - # https://github.community/t/always-save-new-cache-for-incremental-builds/172791 - restore-keys: "${{ runner.os }}-frankenphp-xdebug-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-buildx-cache-${{ vars.CACHE_VERSION }}-" + path: "~/.cache/bazel" + key: "${{ runner.os }}-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-bazel-cache-${{ vars.CACHE_VERSION }}-${{ steps.generate-uuid.outputs.uuid }}" + restore-keys: "${{ runner.os }}-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-bazel-cache-${{ vars.CACHE_VERSION }}-" - - name: Docker Login - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - logout: true + - name: Setup PHP for Bazel + run: | + set -ex + cat > frankenphp/php-version.bzl < frankenphp/frankenphp-arch.bzl <uri query { - replace authorization REDACTED - } - } - } root * /srv/sylius/public encode zstd br gzip - mercure { - # Transport to use (default to Bolt) - transport_url {$MERCURE_TRANSPORT_URL:bolt:///frankenphp-data/mercure.db} - # Publisher JWT key - publisher_jwt {env.MERCURE_PUBLISHER_JWT_KEY} {env.MERCURE_PUBLISHER_JWT_ALG} - # Subscriber JWT key - subscriber_jwt {env.MERCURE_SUBSCRIBER_JWT_KEY} {env.MERCURE_SUBSCRIBER_JWT_ALG} - # Allow anonymous subscribers (double-check that it's what you want) - anonymous - # Enable the subscription API (double-check that it's what you want) - subscriptions - # Extra directives - {$MERCURE_EXTRA_DIRECTIVES} - } - - vulcain - - # Add links to the API docs and to the Mercure Hub if not set explicitly (e.g. the PWA) - header ?Link `; rel="http://www.w3.org/ns/hydra/core#apiDocumentation", ; rel="mercure"` - # Disable Topics tracking if not enabled explicitly: https://github.com/jkarlin/topics - header ?Permissions-Policy "browsing-topics=()" - - # Matches requests for HTML documents, for static files and for Next.js files, - # except for known API paths and paths with extensions handled by API Platform - @pwa expression `( - header({'Accept': '*text/html*'}) - && !path( - '/docs*', '/graphql*', '/bundles*', '/contexts*', '/_profiler*', '/_wdt*', - '*.json*', '*.html', '*.csv', '*.yml', '*.yaml', '*.xml' - ) - ) - || path('/favicon.ico', '/manifest.json', '/robots.txt', '/sitemap*', '/_next*', '/__next*') - || query({'_rsc': '*'})` - - # Comment the following line if you don't want Next.js to catch requests for HTML documents. - # In this case, they will be handled by the PHP app. - # reverse_proxy @pwa http://{$PWA_UPSTREAM} - php_server } diff --git a/frankenphp/Dockerfile b/frankenphp/Dockerfile index 238cad6..b29b4ef 100644 --- a/frankenphp/Dockerfile +++ b/frankenphp/Dockerfile @@ -6,40 +6,15 @@ ARG FRANKENPHP_VERSION=1.5-php8.2-alpine # Versions FROM dunglas/frankenphp:${FRANKENPHP_VERSION} AS frankenphp_upstream - # The different stages of this Dockerfile are meant to be built into separate images # https://docs.docker.com/develop/develop-images/multistage-build/#stop-at-a-specific-build-stage # https://docs.docker.com/compose/compose-file/#target - # Base FrankenPHP image FROM frankenphp_upstream AS frankenphp_base WORKDIR /srv/sylius -# persistent / runtime deps -# hadolint ignore=DL3008 -RUN if grep -q "Ubuntu" /etc/os-release; then \ - apt-get update \ - && apt-get install --no-install-recommends -y \ - acl \ - file \ - gettext \ - git \ - libnss3-tools \ - && rm -rf /var/lib/apt/lists/*; \ -elif grep -q "Alpine Linux" /etc/os-release; then \ - apk add --no-cache --virtual .build-deps $PHPIZE_DEPS linux-headers \ - && apk add --no-cache \ - acl \ - file \ - gettext \ - git \ - nss-tools \ - curl \ - && apk del .build-deps; \ -fi - # https://getcomposer.org/doc/03-cli.md#composer-allow-superuser ENV COMPOSER_ALLOW_SUPERUSER=1 @@ -56,24 +31,19 @@ RUN install-php-extensions \ zip COPY --link conf.d/app.ini $PHP_INI_DIR/conf.d/ -COPY --link --chmod=755 docker-entrypoint.sh /usr/local/bin/docker-entrypoint +COPY --link conf.d/app-cli.ini $PHP_INI_DIR/conf.d/ COPY --link Caddyfile /etc/caddy/Caddyfile -ENTRYPOINT ["docker-entrypoint"] - HEALTHCHECK --start-period=60s CMD curl -f http://localhost:2019/metrics || exit 1 CMD [ "frankenphp", "run", "--config", "/etc/caddy/Caddyfile" ] -RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini.production.backup" -RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini.development.backup" - # Dev FrankenPHP image FROM frankenphp_base AS frankenphp_dev ENV APP_ENV=dev XDEBUG_MODE=off VOLUME /app/var/ -RUN cp "$PHP_INI_DIR/php.ini.development.backup" "$PHP_INI_DIR/php.ini" +RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" RUN set -eux; \ install-php-extensions \ @@ -81,7 +51,6 @@ RUN set -eux; \ ; COPY --link conf.d/app.dev.ini $PHP_INI_DIR/conf.d/ -COPY --link conf.d/app-cli.ini $PHP_INI_DIR/conf.d/ CMD [ "frankenphp", "run", "--config", "/etc/caddy/Caddyfile", "--watch" ] @@ -91,8 +60,7 @@ FROM frankenphp_base AS frankenphp_prod ENV APP_ENV=prod ENV FRANKENPHP_CONFIG="import worker.Caddyfile" -RUN cp "$PHP_INI_DIR/php.ini.production.backup" "$PHP_INI_DIR/php.ini" +RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" COPY --link conf.d/app.prod.ini $PHP_INI_DIR/conf.d/ -COPY --link conf.d/app-cli.ini $PHP_INI_DIR/conf.d/ COPY --link worker.Caddyfile /etc/caddy/worker.Caddyfile diff --git a/frankenphp/conf.d/app.dev.ini b/frankenphp/conf.d/app.dev.ini new file mode 100644 index 0000000..52bcb29 --- /dev/null +++ b/frankenphp/conf.d/app.dev.ini @@ -0,0 +1,5 @@ +; See https://docs.docker.com/desktop/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host +; See https://github.com/docker/for-linux/issues/264 +; The `client_host` below may optionally be replaced with `discover_client_host=yes` +; Add `start_with_request=yes` to start debug session on each request +xdebug.client_host = xdebug://gateway diff --git a/frankenphp/docker-entrypoint.sh b/frankenphp/docker-entrypoint.sh deleted file mode 100644 index cc779cd..0000000 --- a/frankenphp/docker-entrypoint.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh -set -e - -if [ "$1" = 'frankenphp' ] || [ "$1" = 'php' ] || [ "$1" = 'bin/console' ]; then - if [ -z "$(ls -A 'vendor/' 2>/dev/null)" ]; then - composer install --prefer-dist --no-progress --no-interaction - fi - - if grep -q ^DATABASE_URL= .env; then - echo "Waiting for database to be ready..." - ATTEMPTS_LEFT_TO_REACH_DATABASE=60 - until [ $ATTEMPTS_LEFT_TO_REACH_DATABASE -eq 0 ] || DATABASE_ERROR=$(php bin/console dbal:run-sql -q "SELECT 1" 2>&1); do - if [ $? -eq 255 ]; then - # If the Doctrine command exits with 255, an unrecoverable error occurred - ATTEMPTS_LEFT_TO_REACH_DATABASE=0 - break - fi - sleep 1 - ATTEMPTS_LEFT_TO_REACH_DATABASE=$((ATTEMPTS_LEFT_TO_REACH_DATABASE - 1)) - echo "Still waiting for database to be ready... Or maybe the database is not reachable. $ATTEMPTS_LEFT_TO_REACH_DATABASE attempts left." - done - - if [ $ATTEMPTS_LEFT_TO_REACH_DATABASE -eq 0 ]; then - echo "The database is not up or not reachable:" - echo "$DATABASE_ERROR" - exit 1 - else - echo "The database is now ready and reachable" - fi - - if [ "$( find ./migrations -iname '*.php' -print -quit )" ]; then - php bin/console doctrine:migrations:migrate --no-interaction --all-or-nothing - fi - fi - - setfacl -R -m u:www-data:rwX -m u:"$(whoami)":rwX var - setfacl -dR -m u:www-data:rwX -m u:"$(whoami)":rwX var -fi - -exec docker-php-entrypoint "$@" diff --git a/frankenphp/xdebug.Dockerfile b/frankenphp/xdebug.Dockerfile deleted file mode 100644 index 6992259..0000000 --- a/frankenphp/xdebug.Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -ARG IMAGE_NAME -ARG IMAGE_TAG - -FROM ${IMAGE_NAME}:${IMAGE_TAG} - -RUN install-php-extensions xdebug From eb5e7c92c6315c47e25eb9daf0c461b5aaca386a Mon Sep 17 00:00:00 2001 From: Francis Hilaire Date: Wed, 2 Apr 2025 18:56:17 +0200 Subject: [PATCH 36/43] Remove fpm for Bazel tests --- .../testdata/frankenphp-php8.2_amd64.yaml | 49 +------------------ .../testdata/frankenphp-php8.2_arm64.yaml | 49 +------------------ .../testdata/frankenphp-php8.3_amd64.yaml | 49 +------------------ .../testdata/frankenphp-php8.3_arm64.yaml | 49 +------------------ .../testdata/frankenphp-php8.4_amd64.yaml | 49 +------------------ .../testdata/frankenphp-php8.4_arm64.yaml | 49 +------------------ 6 files changed, 6 insertions(+), 288 deletions(-) diff --git a/frankenphp/testdata/frankenphp-php8.2_amd64.yaml b/frankenphp/testdata/frankenphp-php8.2_amd64.yaml index 3e96462..c42da35 100644 --- a/frankenphp/testdata/frankenphp-php8.2_amd64.yaml +++ b/frankenphp/testdata/frankenphp-php8.2_amd64.yaml @@ -1,13 +1,10 @@ schemaVersion: "1.0.0" fileExistenceTests: - - name: php-fpm executable - path: '/usr/local/sbin/php-fpm' - shouldExist: true - name: php executable path: '/usr/local/bin/php' shouldExist: true - name: 'Composer 755' - path: '/usr/bin/composer' + path: '/usr/local/bin/composer' shouldExist: true permissions: '-rwxr-xr-x' - name: 'PHP Entry point 755' @@ -18,50 +15,6 @@ commandTests: - name: arch command: [ "uname", "-m" ] expectedOutput: [ "x86_64" ] - - name: php-fpm version - command: [ "/usr/local/sbin/php-fpm", "--version" ] - expectedOutput: [ "PHP 8.2" ] - - name: php-fpm-modules - command: [ "/usr/local/sbin/php-fpm", "-m" ] - expectedOutput: - - 'apcu' - - 'cgi-fcgi' - - 'Core' - - 'ctype' - - 'curl' - - 'date' - - 'dom' - - 'exif' - - 'fileinfo' - - 'filter' - - 'gd' - - 'hash' - - 'iconv' - - 'intl' - - 'json' - - 'libxml' - - 'mbstring' - - 'mysqlnd' - - 'openssl' - - 'pcre' - - 'PDO' - - 'pdo_mysql' - - 'Phar' - - 'posix' - - 'readline' - - 'Reflection' - - 'session' - - 'SimpleXML' - - 'sodium' - - 'SPL' - - 'standard' - - 'tokenizer' - - 'xml' - - 'xmlreader' - - 'xmlwriter' - - 'Zend OPcache' - - 'zip' - - 'zlib' - name: php-cli version command: [ "/usr/local/bin/php", "--version" ] expectedOutput: [ "PHP 8.2" ] diff --git a/frankenphp/testdata/frankenphp-php8.2_arm64.yaml b/frankenphp/testdata/frankenphp-php8.2_arm64.yaml index 0eb7a34..afa493b 100644 --- a/frankenphp/testdata/frankenphp-php8.2_arm64.yaml +++ b/frankenphp/testdata/frankenphp-php8.2_arm64.yaml @@ -1,13 +1,10 @@ schemaVersion: "1.0.0" fileExistenceTests: - - name: php-fpm executable - path: '/usr/local/sbin/php-fpm' - shouldExist: true - name: php executable path: '/usr/local/bin/php' shouldExist: true - name: 'Composer 755' - path: '/usr/bin/composer' + path: '/usr/local/bin/composer' shouldExist: true permissions: '-rwxr-xr-x' - name: 'PHP Entry point 755' @@ -18,50 +15,6 @@ commandTests: - name: arch command: [ "uname", "-m" ] expectedOutput: [ "aarch64" ] - - name: php-fpm version - command: [ "/usr/local/sbin/php-fpm", "--version" ] - expectedOutput: [ "PHP 8.2" ] - - name: php-fpm-modules - command: [ "/usr/local/sbin/php-fpm", "-m" ] - expectedOutput: - - 'apcu' - - 'cgi-fcgi' - - 'Core' - - 'ctype' - - 'curl' - - 'date' - - 'dom' - - 'exif' - - 'fileinfo' - - 'filter' - - 'gd' - - 'hash' - - 'iconv' - - 'intl' - - 'json' - - 'libxml' - - 'mbstring' - - 'mysqlnd' - - 'openssl' - - 'pcre' - - 'PDO' - - 'pdo_mysql' - - 'Phar' - - 'posix' - - 'readline' - - 'Reflection' - - 'session' - - 'SimpleXML' - - 'sodium' - - 'SPL' - - 'standard' - - 'tokenizer' - - 'xml' - - 'xmlreader' - - 'xmlwriter' - - 'Zend OPcache' - - 'zip' - - 'zlib' - name: php-cli version command: [ "/usr/local/bin/php", "--version" ] expectedOutput: [ "PHP 8.2" ] diff --git a/frankenphp/testdata/frankenphp-php8.3_amd64.yaml b/frankenphp/testdata/frankenphp-php8.3_amd64.yaml index 123f20d..8b682db 100644 --- a/frankenphp/testdata/frankenphp-php8.3_amd64.yaml +++ b/frankenphp/testdata/frankenphp-php8.3_amd64.yaml @@ -1,13 +1,10 @@ schemaVersion: "1.0.0" fileExistenceTests: - - name: php-fpm executable - path: '/usr/local/sbin/php-fpm' - shouldExist: true - name: php executable path: '/usr/local/bin/php' shouldExist: true - name: 'Composer 755' - path: '/usr/bin/composer' + path: '/usr/local/bin/composer' shouldExist: true permissions: '-rwxr-xr-x' - name: 'PHP Entry point 755' @@ -18,50 +15,6 @@ commandTests: - name: arch command: [ "uname", "-m" ] expectedOutput: [ "x86_64" ] - - name: php-fpm version - command: [ "/usr/local/sbin/php-fpm", "--version" ] - expectedOutput: [ "PHP 8.3" ] - - name: php-fpm-modules - command: [ "/usr/local/sbin/php-fpm", "-m" ] - expectedOutput: - - 'apcu' - - 'cgi-fcgi' - - 'Core' - - 'ctype' - - 'curl' - - 'date' - - 'dom' - - 'exif' - - 'fileinfo' - - 'filter' - - 'gd' - - 'hash' - - 'iconv' - - 'intl' - - 'json' - - 'libxml' - - 'mbstring' - - 'mysqlnd' - - 'openssl' - - 'pcre' - - 'PDO' - - 'pdo_mysql' - - 'Phar' - - 'posix' - - 'readline' - - 'Reflection' - - 'session' - - 'SimpleXML' - - 'sodium' - - 'SPL' - - 'standard' - - 'tokenizer' - - 'xml' - - 'xmlreader' - - 'xmlwriter' - - 'Zend OPcache' - - 'zip' - - 'zlib' - name: php-cli version command: [ "/usr/local/bin/php", "--version" ] expectedOutput: [ "PHP 8.3" ] diff --git a/frankenphp/testdata/frankenphp-php8.3_arm64.yaml b/frankenphp/testdata/frankenphp-php8.3_arm64.yaml index ef4091e..d4ca9fb 100644 --- a/frankenphp/testdata/frankenphp-php8.3_arm64.yaml +++ b/frankenphp/testdata/frankenphp-php8.3_arm64.yaml @@ -1,13 +1,10 @@ schemaVersion: "1.0.0" fileExistenceTests: - - name: php-fpm executable - path: '/usr/local/sbin/php-fpm' - shouldExist: true - name: php executable path: '/usr/local/bin/php' shouldExist: true - name: 'Composer 755' - path: '/usr/bin/composer' + path: '/usr/local/bin/composer' shouldExist: true permissions: '-rwxr-xr-x' - name: 'PHP Entry point 755' @@ -18,50 +15,6 @@ commandTests: - name: arch command: [ "uname", "-m" ] expectedOutput: [ "aarch64" ] - - name: php-fpm version - command: [ "/usr/local/sbin/php-fpm", "--version" ] - expectedOutput: [ "PHP 8.3" ] - - name: php-fpm-modules - command: [ "/usr/local/sbin/php-fpm", "-m" ] - expectedOutput: - - 'apcu' - - 'cgi-fcgi' - - 'Core' - - 'ctype' - - 'curl' - - 'date' - - 'dom' - - 'exif' - - 'fileinfo' - - 'filter' - - 'gd' - - 'hash' - - 'iconv' - - 'intl' - - 'json' - - 'libxml' - - 'mbstring' - - 'mysqlnd' - - 'openssl' - - 'pcre' - - 'PDO' - - 'pdo_mysql' - - 'Phar' - - 'posix' - - 'readline' - - 'Reflection' - - 'session' - - 'SimpleXML' - - 'sodium' - - 'SPL' - - 'standard' - - 'tokenizer' - - 'xml' - - 'xmlreader' - - 'xmlwriter' - - 'Zend OPcache' - - 'zip' - - 'zlib' - name: php-cli version command: [ "/usr/local/bin/php", "--version" ] expectedOutput: [ "PHP 8.3" ] diff --git a/frankenphp/testdata/frankenphp-php8.4_amd64.yaml b/frankenphp/testdata/frankenphp-php8.4_amd64.yaml index e7eccb5..44e8ecf 100644 --- a/frankenphp/testdata/frankenphp-php8.4_amd64.yaml +++ b/frankenphp/testdata/frankenphp-php8.4_amd64.yaml @@ -1,13 +1,10 @@ schemaVersion: "1.0.0" fileExistenceTests: - - name: php-fpm executable - path: '/usr/local/sbin/php-fpm' - shouldExist: true - name: php executable path: '/usr/local/bin/php' shouldExist: true - name: 'Composer 755' - path: '/usr/bin/composer' + path: '/usr/local/bin/composer' shouldExist: true permissions: '-rwxr-xr-x' - name: 'PHP Entry point 755' @@ -18,50 +15,6 @@ commandTests: - name: arch command: [ "uname", "-m" ] expectedOutput: [ "x86_64" ] - - name: php-fpm version - command: [ "/usr/local/sbin/php-fpm", "--version" ] - expectedOutput: [ "PHP 8.4" ] - - name: php-fpm-modules - command: [ "/usr/local/sbin/php-fpm", "-m" ] - expectedOutput: - - 'apcu' - - 'cgi-fcgi' - - 'Core' - - 'ctype' - - 'curl' - - 'date' - - 'dom' - - 'exif' - - 'fileinfo' - - 'filter' - - 'gd' - - 'hash' - - 'iconv' - - 'intl' - - 'json' - - 'libxml' - - 'mbstring' - - 'mysqlnd' - - 'openssl' - - 'pcre' - - 'PDO' - - 'pdo_mysql' - - 'Phar' - - 'posix' - - 'readline' - - 'Reflection' - - 'session' - - 'SimpleXML' - - 'sodium' - - 'SPL' - - 'standard' - - 'tokenizer' - - 'xml' - - 'xmlreader' - - 'xmlwriter' - - 'Zend OPcache' - - 'zip' - - 'zlib' - name: php-cli version command: [ "/usr/local/bin/php", "--version" ] expectedOutput: [ "PHP 8.4" ] diff --git a/frankenphp/testdata/frankenphp-php8.4_arm64.yaml b/frankenphp/testdata/frankenphp-php8.4_arm64.yaml index 9c4b469..d53c0f3 100644 --- a/frankenphp/testdata/frankenphp-php8.4_arm64.yaml +++ b/frankenphp/testdata/frankenphp-php8.4_arm64.yaml @@ -1,13 +1,10 @@ schemaVersion: "1.0.0" fileExistenceTests: - - name: php-fpm executable - path: '/usr/local/sbin/php-fpm' - shouldExist: true - name: php executable path: '/usr/local/bin/php' shouldExist: true - name: 'Composer 755' - path: '/usr/bin/composer' + path: '/usr/local/bin/composer' shouldExist: true permissions: '-rwxr-xr-x' - name: 'PHP Entry point 755' @@ -18,50 +15,6 @@ commandTests: - name: arch command: [ "uname", "-m" ] expectedOutput: [ "aarch64" ] - - name: php-fpm version - command: [ "/usr/local/sbin/php-fpm", "--version" ] - expectedOutput: [ "PHP 8.4" ] - - name: php-fpm-modules - command: [ "/usr/local/sbin/php-fpm", "-m" ] - expectedOutput: - - 'apcu' - - 'cgi-fcgi' - - 'Core' - - 'ctype' - - 'curl' - - 'date' - - 'dom' - - 'exif' - - 'fileinfo' - - 'filter' - - 'gd' - - 'hash' - - 'iconv' - - 'intl' - - 'json' - - 'libxml' - - 'mbstring' - - 'mysqlnd' - - 'openssl' - - 'pcre' - - 'PDO' - - 'pdo_mysql' - - 'Phar' - - 'posix' - - 'readline' - - 'Reflection' - - 'session' - - 'SimpleXML' - - 'sodium' - - 'SPL' - - 'standard' - - 'tokenizer' - - 'xml' - - 'xmlreader' - - 'xmlwriter' - - 'Zend OPcache' - - 'zip' - - 'zlib' - name: php-cli version command: [ "/usr/local/bin/php", "--version" ] expectedOutput: [ "PHP 8.4" ] From 84e3161a7b6fa8eb0de7ca83f21ff5f0545fcb8f Mon Sep 17 00:00:00 2001 From: Francis Hilaire Date: Thu, 3 Apr 2025 23:25:38 +0200 Subject: [PATCH 37/43] Remove not required Caddyfile --- frankenphp/Caddyfile | 17 ----------------- frankenphp/Dockerfile | 1 - 2 files changed, 18 deletions(-) delete mode 100644 frankenphp/Caddyfile diff --git a/frankenphp/Caddyfile b/frankenphp/Caddyfile deleted file mode 100644 index 828e20c..0000000 --- a/frankenphp/Caddyfile +++ /dev/null @@ -1,17 +0,0 @@ -{ - {$CADDY_GLOBAL_OPTIONS} - - frankenphp { - {$FRANKENPHP_CONFIG} - } -} - -{$CADDY_EXTRA_CONFIG} - -{$SERVER_NAME:localhost} { - - root * /srv/sylius/public - encode zstd br gzip - - php_server -} diff --git a/frankenphp/Dockerfile b/frankenphp/Dockerfile index b29b4ef..b345e38 100644 --- a/frankenphp/Dockerfile +++ b/frankenphp/Dockerfile @@ -32,7 +32,6 @@ RUN install-php-extensions \ COPY --link conf.d/app.ini $PHP_INI_DIR/conf.d/ COPY --link conf.d/app-cli.ini $PHP_INI_DIR/conf.d/ -COPY --link Caddyfile /etc/caddy/Caddyfile HEALTHCHECK --start-period=60s CMD curl -f http://localhost:2019/metrics || exit 1 CMD [ "frankenphp", "run", "--config", "/etc/caddy/Caddyfile" ] From b82d5e38bd89b45f1d4ffb20bdf71ab1d5feda45 Mon Sep 17 00:00:00 2001 From: Francis Hilaire Date: Thu, 3 Apr 2025 23:26:11 +0200 Subject: [PATCH 38/43] Add dev target to build XDebug image --- .github/workflows/sylius-frankenphp.yml | 82 +++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/.github/workflows/sylius-frankenphp.yml b/.github/workflows/sylius-frankenphp.yml index 46a355a..88af12a 100644 --- a/.github/workflows/sylius-frankenphp.yml +++ b/.github/workflows/sylius-frankenphp.yml @@ -157,3 +157,85 @@ jobs: run: | rm -rf /tmp/.buildx-cache mv /tmp/.buildx-cache-new /tmp/.buildx-cache + + build-xdebug: + needs: build + + name: "Sylius FrankenPHP with Xdebug - ${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}" + + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + frankenphp: [ "1.5-php" ] + php: [ "8.2", "8.3", "8.4" ] + distro: [ "alpine" ] + + steps: + + - uses: actions/checkout@v4 + + - name: Generate UUID + id: generate-uuid + run: | + UUID=$(cat /proc/sys/kernel/random/uuid) + echo "UUID=${UUID}" >> $GITHUB_OUTPUT + + - name: Set up QEMU + id: qemu + uses: docker/setup-qemu-action@v3 + + - name: Available platforms + run: echo ${{ steps.qemu.outputs.platforms }} + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository_owner }}/sylius-frankenphp-xdebug-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }} + tags: | + type=raw,value=${{ matrix.frankenphp }}${{ matrix.php }}-xdebug-${{ matrix.distro }} + labels: | + org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }} + org.opencontainers.image.description=Sylius FrankenPHP with XDebug ${{ matrix.frankenphp }}${{ matrix.php }} Docker image + org.opencontainers.image.licenses=MIT + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Cache Docker layers + uses: actions/cache@v4 + with: + path: /tmp/.buildx-cache + key: "${{ runner.os }}-frankenphp-xdebug-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-buildx-cache-${{ vars.CACHE_VERSION }}-${{ steps.generate-uuid.outputs.uuid }}" + # https://github.com/actions/cache/issues/109#issuecomment-558771281 + # https://github.community/t/always-save-new-cache-for-incremental-builds/172791 + restore-keys: "${{ runner.os }}-php-xdebug-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-buildx-cache-${{ vars.CACHE_VERSION }}-" + + - name: Docker Login + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + logout: true + + - name: Build and push + uses: docker/build-push-action@v5.0.0 + with: + file: ./frankenphp/Dockerfile + context: ./frankenphp + build-args: "FRANKENPHP_VERSION=${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}" + platforms: linux/amd64,linux/arm64 + push: ${{ github.ref == 'refs/heads/frankenphp' || github.ref == 'refs/heads/main' || github.event_name == 'release' }} + pull: true + tags: ${{ steps.meta.outputs.tags }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new + target: "frankenphp_dev" + + - name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache From d0ceec8a5b04b9ac858acb1175334423cabf8cca Mon Sep 17 00:00:00 2001 From: Francis Hilaire Date: Mon, 7 Apr 2025 11:23:44 +0200 Subject: [PATCH 39/43] Fix image tag name --- .github/workflows/sylius-frankenphp.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sylius-frankenphp.yml b/.github/workflows/sylius-frankenphp.yml index 88af12a..65fda12 100644 --- a/.github/workflows/sylius-frankenphp.yml +++ b/.github/workflows/sylius-frankenphp.yml @@ -3,7 +3,7 @@ name: PHP Docker Image CI for Sylius on: workflow_dispatch: ~ push: - branches: [ frankenphp ] + branches: [ main, frankenphp ] paths: - 'frankenphp/**' - 'WORKSPACE' @@ -193,7 +193,7 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: ghcr.io/${{ github.repository_owner }}/sylius-frankenphp-xdebug-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }} + images: ghcr.io/${{ github.repository_owner }}/sylius-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}-xdebug-${{ matrix.distro }} tags: | type=raw,value=${{ matrix.frankenphp }}${{ matrix.php }}-xdebug-${{ matrix.distro }} labels: | @@ -208,10 +208,10 @@ jobs: uses: actions/cache@v4 with: path: /tmp/.buildx-cache - key: "${{ runner.os }}-frankenphp-xdebug-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-buildx-cache-${{ vars.CACHE_VERSION }}-${{ steps.generate-uuid.outputs.uuid }}" + key: "${{ runner.os }}-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}-xdebug-${{ matrix.distro }}-buildx-cache-${{ vars.CACHE_VERSION }}-${{ steps.generate-uuid.outputs.uuid }}" # https://github.com/actions/cache/issues/109#issuecomment-558771281 # https://github.community/t/always-save-new-cache-for-incremental-builds/172791 - restore-keys: "${{ runner.os }}-php-xdebug-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-buildx-cache-${{ vars.CACHE_VERSION }}-" + restore-keys: "${{ runner.os }}-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}-xdebug-${{ matrix.distro }}-buildx-cache-${{ vars.CACHE_VERSION }}-" - name: Docker Login uses: docker/login-action@v3 From fedeaaeaec29dd333264e24819ace030227605bf Mon Sep 17 00:00:00 2001 From: Francis Hilaire Date: Mon, 7 Apr 2025 11:51:17 +0200 Subject: [PATCH 40/43] Use secrets and repository var --- .github/workflows/sylius-frankenphp.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/sylius-frankenphp.yml b/.github/workflows/sylius-frankenphp.yml index 65fda12..65294d7 100644 --- a/.github/workflows/sylius-frankenphp.yml +++ b/.github/workflows/sylius-frankenphp.yml @@ -1,4 +1,4 @@ -name: PHP Docker Image CI for Sylius +name: FrankenPHP Docker Image CI for Sylius on: workflow_dispatch: ~ @@ -46,7 +46,7 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: ghcr.io/${{ github.repository_owner }}/sylius-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }} + images: ${{ vars.DOCKER_FRANKENPHP_REPOSITORY_NAME }} tags: | type=raw,value=${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }} labels: | @@ -69,9 +69,9 @@ jobs: - name: Docker Login uses: docker/login-action@v3 with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + registry: ${{ secrets.DOCKER_REGISTRY }} + username: ${{ secrets.DOCKER_REPOSITORY_LOGIN }} + password: ${{ secrets.DOCKER_REPOSITORY_PASSWORD }} logout: true - name: Build multiplatform @@ -193,7 +193,7 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: ghcr.io/${{ github.repository_owner }}/sylius-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}-xdebug-${{ matrix.distro }} + images: ${{ vars.DOCKER_FRANKENPHP_REPOSITORY_NAME }} tags: | type=raw,value=${{ matrix.frankenphp }}${{ matrix.php }}-xdebug-${{ matrix.distro }} labels: | @@ -216,9 +216,9 @@ jobs: - name: Docker Login uses: docker/login-action@v3 with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + registry: ${{ secrets.DOCKER_REGISTRY }} + username: ${{ secrets.DOCKER_REPOSITORY_LOGIN }} + password: ${{ secrets.DOCKER_REPOSITORY_PASSWORD }} logout: true - name: Build and push From 76cfaa3892de907670a75c9f103013ebfdabe299 Mon Sep 17 00:00:00 2001 From: Francis Hilaire Date: Mon, 7 Apr 2025 13:58:07 +0200 Subject: [PATCH 41/43] Remove comments Co-authored-by: Dmitri Perunov --- frankenphp/Dockerfile | 3 --- 1 file changed, 3 deletions(-) diff --git a/frankenphp/Dockerfile b/frankenphp/Dockerfile index b345e38..ed58d4d 100644 --- a/frankenphp/Dockerfile +++ b/frankenphp/Dockerfile @@ -6,9 +6,6 @@ ARG FRANKENPHP_VERSION=1.5-php8.2-alpine # Versions FROM dunglas/frankenphp:${FRANKENPHP_VERSION} AS frankenphp_upstream -# The different stages of this Dockerfile are meant to be built into separate images -# https://docs.docker.com/develop/develop-images/multistage-build/#stop-at-a-specific-build-stage -# https://docs.docker.com/compose/compose-file/#target # Base FrankenPHP image FROM frankenphp_upstream AS frankenphp_base From df616590f3fd565d163b186fe533452a003d9ee9 Mon Sep 17 00:00:00 2001 From: Francis Hilaire Date: Mon, 7 Apr 2025 13:58:26 +0200 Subject: [PATCH 42/43] Remove new lines Co-authored-by: Dmitri Perunov --- .github/workflows/sylius-frankenphp.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/sylius-frankenphp.yml b/.github/workflows/sylius-frankenphp.yml index 65294d7..04b8120 100644 --- a/.github/workflows/sylius-frankenphp.yml +++ b/.github/workflows/sylius-frankenphp.yml @@ -15,9 +15,7 @@ concurrency: cancel-in-progress: false jobs: - build: - name: "Sylius FrankenPHP - ${{ matrix.frankenphp }}${{ matrix.php }} ${{ matrix.distro }}" runs-on: ubuntu-latest From e19ae5d1bc6867a4044a9c014ed12711f6809e54 Mon Sep 17 00:00:00 2001 From: Francis Hilaire Date: Mon, 7 Apr 2025 13:58:33 +0200 Subject: [PATCH 43/43] Remove new lines Co-authored-by: Dmitri Perunov --- .github/workflows/sylius-frankenphp.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/sylius-frankenphp.yml b/.github/workflows/sylius-frankenphp.yml index 04b8120..7af7093 100644 --- a/.github/workflows/sylius-frankenphp.yml +++ b/.github/workflows/sylius-frankenphp.yml @@ -28,7 +28,6 @@ jobs: distro: [ "alpine" ] steps: - - uses: actions/checkout@v4 - name: Generate UUID