Skip to content

Commit 81119b8

Browse files
authored
Merge pull request #584 from BbolroC/enable-multi-arch-image
action: enable nydus-snapshotter image to support multi-arch
2 parents e15c985 + 108e5fe commit 81119b8

File tree

1 file changed

+43
-2
lines changed

1 file changed

+43
-2
lines changed

.github/workflows/release.yml

+43-2
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,27 @@ jobs:
9898
publish-image:
9999
runs-on: ubuntu-latest
100100
needs: [build]
101+
strategy:
102+
matrix:
103+
include:
104+
- build-os: linux
105+
build-arch: amd64
106+
- build-os: linux
107+
build-arch: arm64
108+
- build-os: linux
109+
build-arch: s390x
110+
- build-os: linux
111+
build-arch: ppc64le
101112
steps:
102113
- name: Checkout repository
103114
uses: actions/checkout@v3
115+
116+
- name: Set up QEMU
117+
uses: docker/setup-qemu-action@v3
118+
119+
- name: Set up Docker Buildx
120+
uses: docker/setup-buildx-action@v3
121+
104122
- name: Log in to the container registry
105123
uses: docker/login-action@v2
106124
with:
@@ -110,7 +128,7 @@ jobs:
110128
- name: download artifacts
111129
uses: actions/download-artifact@v3
112130
with:
113-
name: release-tars-linux-static
131+
name: release-tars-${{ matrix.build-os }}-${{ matrix.build-arch }}
114132
path: misc/snapshotter
115133
- name: unpack static release
116134
run: |
@@ -131,6 +149,29 @@ jobs:
131149
context: misc/snapshotter
132150
file: misc/snapshotter/Dockerfile
133151
push: true
134-
tags: ${{ steps.meta.outputs.tags }}
152+
platforms: ${{ matrix.build-os }}/${{ matrix.build-arch }}
153+
tags: ${{ steps.meta.outputs.tags }}-${{ matrix.build-arch }}
135154
labels: ${{ steps.meta.outputs.labels }}
136155
build-args: NYDUS_VER=${{ env.NYDUS_STABLE_VER }}
156+
157+
publish-manifest:
158+
runs-on: ubuntu-latest
159+
needs: [publish-image]
160+
steps:
161+
- name: Log in to the container registry
162+
uses: docker/login-action@v2
163+
with:
164+
registry: ${{ env.REGISTRY }}
165+
username: ${{ github.actor }}
166+
password: ${{ secrets.GITHUB_TOKEN }}
167+
- name: Extract metadata (tags, labels) for Docker
168+
id: meta
169+
uses: docker/metadata-action@v4
170+
with:
171+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
172+
- name: Publish manifest for multi-arch image
173+
run: |
174+
docker manifest create ${{ steps.meta.outputs.tags }} \
175+
--amend ${{ steps.meta.outputs.tags }}-amd64 --amend ${{ steps.meta.outputs.tags }}-arm64 \
176+
--amend ${{ steps.meta.outputs.tags }}-s390x --amend ${{ steps.meta.outputs.tags }}-ppc64le
177+
docker manifest push ${{ steps.meta.outputs.tags }}

0 commit comments

Comments
 (0)