Skip to content

Commit 9e87c7b

Browse files
committed
Build ARM64 and ARMv7 images along side AMD64 images (x86)
1 parent 5833c45 commit 9e87c7b

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ env:
33
DOCKER_IMAGE: wyrihaximusnet/php
44
DOCKER_BUILDKIT: 1
55
DOCKER_IMAGE_REGISTRIES_SECRET_MAPPING: '{"ghcr.io":"GHCR_TOKEN","docker.io":"HUB_PASSCODE"}'
6+
DOCKER_CLI_EXPERIMENTAL: enabled
67
on:
78
push:
89
branches:
@@ -129,6 +130,12 @@ jobs:
129130
image: ${{ fromJson(needs.image-matrix.outputs.image) }}
130131
steps:
131132
- uses: actions/checkout@v2
133+
- name: Set up Docker Buildx
134+
id: buildx
135+
uses: crazy-max/ghaction-docker-buildx@v3
136+
with:
137+
buildx-version: latest
138+
qemu-version: latest
132139
- run: mkdir ./docker-image/
133140
- run: ./build-php.sh $(echo "${{ matrix.image }}" | tr '-' ' ')
134141
- run: cat ./docker-image/image.tags | xargs -I % docker inspect --format='%={{.Id}}:{{index .Config.Env 7}}' %

build-php.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,19 @@ declare -a target=(
4444
"-slim-dev-root"
4545
)
4646

47+
declare -a arch=(
48+
"linux/amd64"
49+
"linux/arm64"
50+
"linux/arm/v7"
51+
)
52+
4753
docker pull "php:${IMAGE_TAG}"
4854

4955
for buildTarget in "${target[@]}"
5056
do
51-
sed -E "s/${IMAGE_ORIGINAL_TAG}/${IMAGE_TAG}/g" "Dockerfile-${DST_IMAGE}-${OS}" | docker build --label org.label-schema.build-date=`date -u +"%Y-%m-%dT%H:%M:%SZ"` --label org.label-schema.vcs-ref=`git rev-parse --short HEAD` -t "${WYRIHAXIMUSNET_TAG}${buildTarget}" --target="${DST_IMAGE}${buildTarget}" -f - .
57+
for buildArch in "${arch[@]}"
58+
do
59+
sed -E "s/${IMAGE_ORIGINAL_TAG}/${IMAGE_TAG}/g" "Dockerfile-${DST_IMAGE}-${OS}" | docker buildx build --platform "${buildArch}" --output "type=docker" --label org.label-schema.build-date=`date -u +"%Y-%m-%dT%H:%M:%SZ"` --label org.label-schema.vcs-ref=`git rev-parse --short HEAD` -t "${WYRIHAXIMUSNET_TAG}${buildTarget}" --target="${DST_IMAGE}${buildTarget}" -f - .
60+
done
5261
echo "${WYRIHAXIMUSNET_TAG}${buildTarget}" >> "$TAG_FILE"
5362
done

0 commit comments

Comments
 (0)