From 0c6c106e446589a5c0b850fb4db458e2569a51b0 Mon Sep 17 00:00:00 2001 From: William Correa Date: Fri, 19 Jun 2026 12:33:37 -0300 Subject: [PATCH 1/2] feat(php-hyperf): add arm-dev variant with per-entry platforms field variants.yaml entries can now declare a 'platforms' field (string, defaults to linux/amd64). The build workflow sets up QEMU and passes the platform list to docker/build-push-action, enabling per-variant cross-builds without duplicating the manifest. validate.yml type-checks the new field. --- .github/workflows/build-images.yml | 8 ++++++-- .github/workflows/validate.yml | 7 +++++++ php-hyperf/8.3/variants.yaml | 5 +++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index a786e29..486f99d 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -134,7 +134,8 @@ jobs: tag: ($ver + (if (.suffix // "") == "" then "" else "-" + .suffix end)), context: $ctx, target: .target, - build_args: ((.args // {}) | to_entries | map(.key + "=" + (.value | tostring)) | join("\n")) + build_args: ((.args // {}) | to_entries | map(.key + "=" + (.value | tostring)) | join("\n")), + platforms: (.platforms // "linux/amd64") } ' <<< "$entries") done @@ -158,6 +159,9 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -173,7 +177,7 @@ jobs: context: ./${{ matrix.build.context }} target: ${{ matrix.build.target }} build-args: ${{ matrix.build.build_args }} - platforms: linux/amd64 + platforms: ${{ matrix.build.platforms }} push: true tags: devitools/${{ matrix.build.image }}:${{ matrix.build.tag }} cache-from: type=gha,scope=${{ matrix.build.image }}-${{ matrix.build.tag }} diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 2e11c82..f9def8e 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -74,6 +74,13 @@ jobs: errors=$((errors+1)) fi + bad_platforms=$(jq -c '[.[] | select(has("platforms") and (.platforms | type) != "string")]' <<< "$entries") + if [ "$(jq 'length' <<< "$bad_platforms")" != "0" ]; then + echo "::error file=${manifest}::'platforms' must be a string when present (e.g. 'linux/amd64' or 'linux/amd64,linux/arm64'):" + jq -r '.[] | " - " + (. | tostring)' <<< "$bad_platforms" + errors=$((errors+1)) + fi + if [ ! -f "$dockerfile" ]; then echo "::error file=${manifest}::sibling Dockerfile not found at ${dockerfile}" errors=$((errors+1)) diff --git a/php-hyperf/8.3/variants.yaml b/php-hyperf/8.3/variants.yaml index 1f541b3..4486bb1 100644 --- a/php-hyperf/8.3/variants.yaml +++ b/php-hyperf/8.3/variants.yaml @@ -4,6 +4,11 @@ target: hyperf args: APP_TARGET: dev +- suffix: arm-dev + target: hyperf + args: + APP_TARGET: dev + platforms: linux/arm64 - suffix: otel target: hyperf-otel args: From 4ff72aa4302c0ff3b952a93a1e64b3bb3098929a Mon Sep 17 00:00:00 2001 From: William Correa Date: Fri, 19 Jun 2026 12:39:10 -0300 Subject: [PATCH 2/2] fix(validate): reject empty platforms string in variants.yaml --- .github/workflows/validate.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index f9def8e..160b905 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -74,9 +74,14 @@ jobs: errors=$((errors+1)) fi - bad_platforms=$(jq -c '[.[] | select(has("platforms") and (.platforms | type) != "string")]' <<< "$entries") + bad_platforms=$(jq -c '[.[] | select( + has("platforms") and ( + (.platforms | type) != "string" or + (.platforms | length) == 0 + ) + )]' <<< "$entries") if [ "$(jq 'length' <<< "$bad_platforms")" != "0" ]; then - echo "::error file=${manifest}::'platforms' must be a string when present (e.g. 'linux/amd64' or 'linux/amd64,linux/arm64'):" + echo "::error file=${manifest}::'platforms' must be a non-empty string when present (e.g. 'linux/amd64' or 'linux/amd64,linux/arm64'):" jq -r '.[] | " - " + (. | tostring)' <<< "$bad_platforms" errors=$((errors+1)) fi