Skip to content

Commit 12f49eb

Browse files
committed
used arm runner
1 parent 0d2f976 commit 12f49eb

File tree

1 file changed

+45
-14
lines changed

1 file changed

+45
-14
lines changed

.github/workflows/docker_image.yml

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,17 @@ on:
1313

1414
jobs:
1515
build-artifacts:
16-
runs-on: ubuntu-latest
1716
strategy:
1817
matrix:
1918
arch: [amd64, arm64]
19+
include:
20+
- arch: amd64
21+
runs-on: ubuntu-latest
22+
- arch: arm64
23+
runs-on: ubuntu-24.04-arm
24+
25+
name: Build for ${{ matrix.arch }}
26+
runs-on: ${{ matrix.runs-on }}
2027

2128
steps:
2229
- name: Checkout code
@@ -25,22 +32,22 @@ jobs:
2532
- name: Set up Docker Buildx
2633
uses: docker/setup-buildx-action@v3
2734

28-
- name: Build and Export Image for ${{ matrix.arch }}
35+
- name: Build and Export Image
2936
run: |
3037
docker buildx build \
3138
--platform linux/${{ matrix.arch }} \
3239
-f docker/Dockerfile \
33-
-t config-tool-${{ matrix.arch }}:latest \
40+
-t config-tool:dev-${{ matrix.arch }} \
3441
--load .
3542
3643
- name: Save Docker image to tar file
3744
run: |
38-
docker save config-tool-${{ matrix.arch }}:latest -o config-tool-${{ matrix.arch }}.tar
45+
docker save config-tool:dev-${{ matrix.arch }} -o config-tool-${{ matrix.arch }}.tar
3946
4047
- name: Upload Docker image artifact
4148
uses: actions/upload-artifact@v4
4249
with:
43-
name: config-tool-image-${{ matrix.arch }}
50+
name: config-tool-${{ matrix.arch }}
4451
path: config-tool-${{ matrix.arch }}.tar
4552

4653
publish-multiarch:
@@ -49,25 +56,49 @@ jobs:
4956
runs-on: ubuntu-latest
5057

5158
steps:
52-
- name: Checkout code
53-
uses: actions/checkout@v4
59+
- name: Download artifacts
60+
uses: actions/download-artifact@v4
61+
with:
62+
path: artifacts/
63+
64+
- name: Load Docker images
65+
run: |
66+
docker load -i artifacts/config-tool-amd64.tar # Loads as config-tool:dev-amd64
67+
docker load -i artifacts/config-tool-arm64.tar # Loads as config-tool:dev-arm64
5468
5569
- name: Set up Docker Buildx
5670
uses: docker/setup-buildx-action@v3
5771

72+
- name: Set up QEMU
73+
uses: docker/setup-qemu-action@v3
74+
5875
- name: Log in to GitHub Container Registry
5976
uses: docker/login-action@v3
6077
with:
6178
registry: ghcr.io
6279
username: ${{ github.actor }}
6380
password: ${{ secrets.GITHUB_TOKEN }}
6481

65-
- name: Build and Push Multi-Arch Docker Image to GHCR
82+
- name: Create and push multi-arch manifest
6683
run: |
6784
VERSION=${GITHUB_REF#refs/tags/}
68-
docker buildx build \
69-
--platform linux/amd64,linux/arm64 \
70-
-f docker/Dockerfile \
71-
-t ghcr.io/${{ github.repository_owner }}/config-tool:${VERSION} \
72-
-t ghcr.io/${{ github.repository_owner }}/config-tool:latest \
73-
--push .
85+
86+
# Retag the loaded images (using the correct dev-* tags)
87+
docker tag config-tool:dev-amd64 ghcr.io/${{ github.repository_owner }}/config-tool:$VERSION-amd64
88+
docker tag config-tool:dev-arm64 ghcr.io/${{ github.repository_owner }}/config-tool:$VERSION-arm64
89+
90+
# Push arch-specific images
91+
docker push ghcr.io/${{ github.repository_owner }}/config-tool:$VERSION-amd64
92+
docker push ghcr.io/${{ github.repository_owner }}/config-tool:$VERSION-arm64
93+
94+
# Create and push manifests
95+
docker manifest create ghcr.io/${{ github.repository_owner }}/config-tool:$VERSION \
96+
--amend ghcr.io/${{ github.repository_owner }}/config-tool:$VERSION-amd64 \
97+
--amend ghcr.io/${{ github.repository_owner }}/config-tool:$VERSION-arm64
98+
99+
docker manifest create ghcr.io/${{ github.repository_owner }}/config-tool:latest \
100+
--amend ghcr.io/${{ github.repository_owner }}/config-tool:$VERSION-amd64 \
101+
--amend ghcr.io/${{ github.repository_owner }}/config-tool:$VERSION-arm64
102+
103+
docker manifest push ghcr.io/${{ github.repository_owner }}/config-tool:$VERSION
104+
docker manifest push ghcr.io/${{ github.repository_owner }}/config-tool:latest

0 commit comments

Comments
 (0)