Skip to content

Commit dd23080

Browse files
committed
Support build arm64 for swoole/swow images.
1 parent 225888c commit dd23080

File tree

3 files changed

+116
-36
lines changed

3 files changed

+116
-36
lines changed

.github/workflows/build-swoole.yml

Lines changed: 53 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,58 @@ jobs:
5454
default => substr($phpVersion, 0, 1)
5555
};
5656
echo "::set-output name=version::" . $version . PHP_EOL;
57-
- name: Build
58-
run: export PHP_BUILD_VERSION=${{ steps.fetch-php-build-version.outputs.version }} && docker-compose build alpine-swoole
59-
- name: Push Images to Docker Hub
57+
- name: Set up QEMU
58+
uses: docker/setup-qemu-action@v3
59+
- name: Set up Docker Buildx
60+
uses: docker/setup-buildx-action@v3
61+
- name: Login to Docker Hub
62+
uses: docker/login-action@v3
63+
with:
64+
username: limingxinleo
65+
password: ${{ secrets.DOCKERHUB_ACCESSTOKEN }}
66+
- name: Docker meta
67+
id: meta
68+
uses: docker/metadata-action@v5
69+
with:
70+
# list of Docker images to use as base name for tags
71+
images: |
72+
hyperf/hyperf
73+
tags: |
74+
type=semver,pattern=${{ matrix.php-version }}-alpine-v${{ matrix.alpine-version }}-${{ env.ENGINE }}${{ env.SPEC }}-v{{version}},value=${{ env.SW_VERSION }}
75+
type=semver,pattern=${{ matrix.php-version }}-alpine-v${{ matrix.alpine-version }}-${{ env.ENGINE }}${{ env.SPEC }}-v{{major}}.{{minor}},value=${{ env.SW_VERSION }}
76+
type=semver,pattern=${{ matrix.php-version }}-alpine-v${{ matrix.alpine-version }}-${{ env.ENGINE }}${{ env.SPEC }}-v{{major}},value=${{ env.SW_VERSION }}
77+
type=raw,value=${{ matrix.php-version }}-alpine-v${{ matrix.alpine-version }}-${{ env.ENGINE }}${{ env.SPEC }}
78+
- name: Build and export to Docker
79+
uses: docker/build-push-action@v5
80+
with:
81+
context: ${{ matrix.php-version }}/alpine/swoole
82+
load: true
83+
tags: hyperf/hyperf:${{ matrix.php-version }}-alpine-v${{ matrix.alpine-version }}-swoole
84+
file: ${{ matrix.php-version }}/alpine/swoole/Dockerfile${{ env.SPEC }}
85+
build-args: |
86+
"ALPINE_VERSION=${{ matrix.alpine-version }}"
87+
"COMPOSER_VERSION=${{ env.COMPOSER_VERSION }}"
88+
"PHP_BUILD_VERSION=${{ steps.fetch-php-build-version.outputs.version }}"
89+
"SW_VERSION=${{ env.SW_VERSION }}"
90+
- name: Check
91+
run: |
92+
docker run --entrypoint php hyperf/hyperf:${{ matrix.php-version }}-alpine-v${{ matrix.alpine-version }}-swoole -v
93+
docker run --entrypoint php hyperf/hyperf:${{ matrix.php-version }}-alpine-v${{ matrix.alpine-version }}-swoole --ri swoole
94+
- name: Push
95+
if: ${{ github.ref == 'refs/heads/build' }}
96+
uses: docker/build-push-action@v5
97+
with:
98+
context: ${{ matrix.php-version }}/alpine/swoole
99+
push: true
100+
platforms: linux/amd64,linux/arm64
101+
tags: ${{ steps.meta.outputs.tags }}
102+
file: ${{ matrix.php-version }}/alpine/swoole/Dockerfile${{ env.SPEC }}
103+
build-args: |
104+
"ALPINE_VERSION=${{ matrix.alpine-version }}"
105+
"COMPOSER_VERSION=${{ env.COMPOSER_VERSION }}"
106+
"PHP_BUILD_VERSION=${{ steps.fetch-php-build-version.outputs.version }}"
107+
"SW_VERSION=${{ env.SW_VERSION }}"
108+
- name: Push Images to Other Hubs
60109
if: ${{ github.ref == 'refs/heads/build' }}
61110
run: ./.github/workflows/push.sh
62-
- name: Push the latest images
63-
if: ${{ github.ref == 'refs/heads/build' && matrix.php-version == '8.3' && matrix.alpine-version == '3.19' && matrix.spec == '' }}
64-
run: |
65-
docker push hyperf/hyperf:latest
66-
docker push ghcr.io/hyperf/hyperf-docker/hyperf:latest
67-
docker push hyperf-cloud-docker.pkg.coding.net/hyperf/hyperf/hyperf:latest
68-
111+

.github/workflows/build-swow.yml

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,57 @@ jobs:
5454
default => substr($phpVersion, 0, 1)
5555
};
5656
echo "::set-output name=version::" . $version . PHP_EOL;
57-
- name: Build
58-
run: export PHP_BUILD_VERSION=${{ steps.fetch-php-build-version.outputs.version }} && docker-compose build alpine-swow
59-
- name: Push Images to Docker Hub
60-
if: ${{ github.ref == 'refs/heads/build'}}
57+
- name: Set up QEMU
58+
uses: docker/setup-qemu-action@v3
59+
- name: Set up Docker Buildx
60+
uses: docker/setup-buildx-action@v3
61+
- name: Login to Docker Hub
62+
uses: docker/login-action@v3
63+
with:
64+
username: limingxinleo
65+
password: ${{ secrets.DOCKERHUB_ACCESSTOKEN }}
66+
- name: Docker meta
67+
id: meta
68+
uses: docker/metadata-action@v5
69+
with:
70+
# list of Docker images to use as base name for tags
71+
images: |
72+
hyperf/hyperf
73+
tags: |
74+
type=semver,pattern=${{ matrix.php-version }}-alpine-v${{ matrix.alpine-version }}-${{ env.ENGINE }}${{ env.SPEC }}-v{{version}},value=${{ env.SW_VERSION }}
75+
type=semver,pattern=${{ matrix.php-version }}-alpine-v${{ matrix.alpine-version }}-${{ env.ENGINE }}${{ env.SPEC }}-v{{major}}.{{minor}},value=${{ env.SW_VERSION }}
76+
type=semver,pattern=${{ matrix.php-version }}-alpine-v${{ matrix.alpine-version }}-${{ env.ENGINE }}${{ env.SPEC }}-v{{major}},value=${{ env.SW_VERSION }}
77+
type=raw,value=${{ matrix.php-version }}-alpine-v${{ matrix.alpine-version }}-${{ env.ENGINE }}${{ env.SPEC }}
78+
- name: Build and export to Docker
79+
uses: docker/build-push-action@v5
80+
with:
81+
context: ${{ matrix.php-version }}/alpine/swow
82+
load: true
83+
tags: hyperf/hyperf:${{ matrix.php-version }}-alpine-v${{ matrix.alpine-version }}-swow
84+
file: ${{ matrix.php-version }}/alpine/swow/Dockerfile${{ env.SPEC }}
85+
build-args: |
86+
"ALPINE_VERSION=${{ matrix.alpine-version }}"
87+
"COMPOSER_VERSION=${{ env.COMPOSER_VERSION }}"
88+
"PHP_BUILD_VERSION=${{ steps.fetch-php-build-version.outputs.version }}"
89+
"SW_VERSION=${{ env.SW_VERSION }}"
90+
- name: Check
91+
run: |
92+
docker run --entrypoint php hyperf/hyperf:${{ matrix.php-version }}-alpine-v${{ matrix.alpine-version }}-swow -v
93+
docker run --entrypoint php hyperf/hyperf:${{ matrix.php-version }}-alpine-v${{ matrix.alpine-version }}-swow --ri swow
94+
- name: Push
95+
if: ${{ github.ref == 'refs/heads/build' }}
96+
uses: docker/build-push-action@v5
97+
with:
98+
context: ${{ matrix.php-version }}/alpine/swow
99+
push: true
100+
platforms: linux/amd64,linux/arm64
101+
tags: ${{ steps.meta.outputs.tags }}
102+
file: ${{ matrix.php-version }}/alpine/swow/Dockerfile${{ env.SPEC }}
103+
build-args: |
104+
"ALPINE_VERSION=${{ matrix.alpine-version }}"
105+
"COMPOSER_VERSION=${{ env.COMPOSER_VERSION }}"
106+
"PHP_BUILD_VERSION=${{ steps.fetch-php-build-version.outputs.version }}"
107+
"SW_VERSION=${{ env.SW_VERSION }}"
108+
- name: Push Images to Other Hubs
109+
if: ${{ github.ref == 'refs/heads/build' }}
61110
run: ./.github/workflows/push.sh

.github/workflows/push.sh

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,27 @@
11
#!/usr/bin/env bash
22

33
# Login
4-
docker login --username limingxinleo -p $DOCKERHUB_TOKEN
54
docker login ghcr.io --username limingxinleo -p $GITHUB_TOKEN
65
docker login hyperf-cloud-docker.pkg.coding.net --username hyperf-1718463997529 -p $CODING_PASSWORD
76

8-
# Push to DockerHub
9-
docker tag hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION} hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION%\.*}
10-
docker tag hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION} hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION%%\.*}
11-
docker tag hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION} hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}
12-
docker tag hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION} hyperf/hyperf:latest
13-
14-
docker push hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION}
15-
docker push hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION%\.*}
16-
docker push hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION%%\.*}
17-
docker push hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}
18-
197
# Push to Github
20-
docker tag hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION} ghcr.io/hyperf/hyperf-docker/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION}
21-
docker tag hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION} ghcr.io/hyperf/hyperf-docker/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION%\.*}
22-
docker tag hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION} ghcr.io/hyperf/hyperf-docker/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION%%\.*}
23-
docker tag hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION} ghcr.io/hyperf/hyperf-docker/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}
24-
docker tag hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION} ghcr.io/hyperf/hyperf-docker/hyperf:latest
8+
docker tag hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC} ghcr.io/hyperf/hyperf-docker/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION}
9+
docker tag hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC} ghcr.io/hyperf/hyperf-docker/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION%\.*}
10+
docker tag hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC} ghcr.io/hyperf/hyperf-docker/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION%%\.*}
11+
docker tag hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC} ghcr.io/hyperf/hyperf-docker/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}
12+
docker tag hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC} ghcr.io/hyperf/hyperf-docker/hyperf:latest
2513

2614
docker push ghcr.io/hyperf/hyperf-docker/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION}
2715
docker push ghcr.io/hyperf/hyperf-docker/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION%\.*}
2816
docker push ghcr.io/hyperf/hyperf-docker/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION%%\.*}
2917
docker push ghcr.io/hyperf/hyperf-docker/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}
3018

3119
# Push to Coding
32-
docker tag hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION} hyperf-cloud-docker.pkg.coding.net/hyperf/hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION}
33-
docker tag hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION} hyperf-cloud-docker.pkg.coding.net/hyperf/hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION%\.*}
34-
docker tag hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION} hyperf-cloud-docker.pkg.coding.net/hyperf/hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION%%\.*}
35-
docker tag hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION} hyperf-cloud-docker.pkg.coding.net/hyperf/hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}
36-
docker tag hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION} hyperf-cloud-docker.pkg.coding.net/hyperf/hyperf/hyperf:latest
20+
docker tag hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC} hyperf-cloud-docker.pkg.coding.net/hyperf/hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION}
21+
docker tag hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC} hyperf-cloud-docker.pkg.coding.net/hyperf/hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION%\.*}
22+
docker tag hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC} hyperf-cloud-docker.pkg.coding.net/hyperf/hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION%%\.*}
23+
docker tag hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC} hyperf-cloud-docker.pkg.coding.net/hyperf/hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}
24+
docker tag hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC} hyperf-cloud-docker.pkg.coding.net/hyperf/hyperf/hyperf:latest
3725

3826
docker push hyperf-cloud-docker.pkg.coding.net/hyperf/hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION}
3927
docker push hyperf-cloud-docker.pkg.coding.net/hyperf/hyperf/hyperf:${PHP_VERSION}-alpine-v${ALPINE_VERSION}-${ENGINE}${SPEC}-${SW_VERSION%\.*}

0 commit comments

Comments
 (0)