Skip to content

Commit e0b3e02

Browse files
committed
✅ test: try Github Action ARM docker tag
1 parent 871cbe9 commit e0b3e02

File tree

1 file changed

+29
-15
lines changed

1 file changed

+29
-15
lines changed

.github/workflows/docker-push-rc.yml

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,51 @@ on:
99
jobs:
1010
docker-hub:
1111
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
platform: ["linux/amd64", "linux/arm64"]
1215
steps:
13-
-
14-
name: Checkout
16+
- name: Checkout
1517
uses: actions/checkout@v4
16-
-
17-
name: Login to Docker Hub
18+
19+
- name: Set up QEMU # 新增模拟器支持 ARM 架构
20+
uses: docker/setup-qemu-action@v3
21+
22+
- name: Set up Docker Buildx # 启用多架构构建工具链
23+
uses: docker/setup-buildx-action@v3
24+
25+
- name: Login to Docker Hub
1826
uses: docker/login-action@v3
1927
with:
2028
username: xcsoft
2129
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
22-
-
23-
name: Set up Docker Build Context
24-
uses: docker/setup-buildx-action@v3
25-
-
26-
name: Build and push
30+
31+
- name: Build and push
2732
uses: docker/build-push-action@v5
2833
with:
2934
context: .
3035
file: ./Dockerfile
36+
platforms: ${{ matrix.platform }} # 动态指定构建平台
3137
push: true
3238
tags: |
33-
xcsoft/busuanzi:${{ github.ref_name }}
39+
xcsoft/busuanzi:${{ github.ref_name }}-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
40+
xcsoft/busuanzi:latest-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
3441
3542
github-docker:
3643
runs-on: ubuntu-latest
44+
strategy: # 同步添加多架构策略
45+
matrix:
46+
platform: ["linux/amd64", "linux/arm64"]
3747
steps:
3848
- name: Checkout
3949
uses: actions/checkout@v4
4050

51+
- name: Set up QEMU
52+
uses: docker/setup-qemu-action@v3
53+
54+
- name: Set up Docker Buildx
55+
uses: docker/setup-buildx-action@v3
56+
4157
- name: Login to Docker Hub
4258
if: github.event_name != 'pull_request'
4359
uses: docker/login-action@v1
@@ -46,15 +62,13 @@ jobs:
4662
username: ${{ github.actor }}
4763
password: ${{ secrets.GITHUB_TOKEN }}
4864

49-
- name: Set up Docker Build Context
50-
51-
uses: docker/setup-buildx-action@v3
52-
5365
- name: Build and push
5466
uses: docker/build-push-action@v5
5567
with:
5668
context: .
5769
file: ./Dockerfile
70+
platforms: ${{ matrix.platform }}
5871
push: true
5972
tags: |
60-
ghcr.io/soxft/busuanzi:${{ github.ref_name }}
73+
ghcr.io/soxft/busuanzi:${{ github.ref_name }}-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
74+
ghcr.io/soxft/busuanzi:latest-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}

0 commit comments

Comments
 (0)