Skip to content

Commit 49fb34c

Browse files
authored
use buildx to merge manifests (#686)
1 parent cbf33f9 commit 49fb34c

File tree

2 files changed

+33
-14
lines changed

2 files changed

+33
-14
lines changed

.github/workflows/main.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ jobs:
1616
include:
1717
- platform: linux/amd64
1818
runner: ubuntu-latest
19+
arch: amd64
1920
- platform: linux/arm64
2021
runner: ubuntu-24.04-arm64
22+
arch: arm64
2123
steps:
2224
- name: Checkout code
2325
uses: actions/checkout@v3
@@ -38,7 +40,7 @@ jobs:
3840
context: .
3941
target: prod
4042
push: true
41-
tags: thirdweb/engine:nightly-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
43+
tags: thirdweb/engine:nightly-${{matrix.arch }}
4244
platforms: ${{ matrix.platform }}
4345
cache-from: type=gha,scope=${{ matrix.platform }}
4446
cache-to: type=gha,scope=${{ matrix.platform }},mode=max
@@ -48,6 +50,9 @@ jobs:
4850
needs: build
4951
runs-on: ubuntu-latest
5052
steps:
53+
- name: Set up Docker Buildx
54+
uses: docker/setup-buildx-action@v3
55+
5156
- name: Login to DockerHub
5257
uses: docker/login-action@v3
5358
with:
@@ -56,7 +61,10 @@ jobs:
5661

5762
- name: Create and Push Multi-arch Manifest
5863
run: |
59-
docker manifest create ${{ env.REGISTRY_IMAGE }}:nightly \
64+
docker buildx imagetools create -t ${{ env.REGISTRY_IMAGE }}:nightly \
6065
${{ env.REGISTRY_IMAGE }}:nightly-amd64 \
6166
${{ env.REGISTRY_IMAGE }}:nightly-arm64
62-
docker manifest push ${{ env.REGISTRY_IMAGE }}:nightly
67+
68+
- name: Inspect image
69+
run: |
70+
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:nightly

.github/workflows/tagBasedImageBuild.yml

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ jobs:
1515
include:
1616
- platform: linux/amd64
1717
runner: ubuntu-latest
18+
arch: amd64
1819
- platform: linux/arm64
1920
runner: ubuntu-24.04-arm64
21+
arch: arm64
2022
env:
2123
LATEST_TAG: ${{ github.event.release.target_commitish == 'main' && 'thirdweb/engine:latest' || '' }}
2224

@@ -43,8 +45,8 @@ jobs:
4345
platforms: ${{ matrix.platform }}
4446
push: true
4547
tags: |
46-
${{ env.REGISTRY_IMAGE }}:${{ github.event.release.tag_name }}-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
47-
${{ env.LATEST_TAG != '' && format('thirdweb/engine:latest-{0}', matrix.platform == 'linux/amd64' && 'amd64' || 'arm64') || '' }}
48+
${{ env.REGISTRY_IMAGE }}:${{ github.event.release.tag_name }}-${{ matrix.arch }}
49+
${{ env.LATEST_TAG != '' && format('thirdweb/engine:latest-{0}', matrix.arch) || '' }}
4850
cache-from: type=gha,scope=${{ matrix.platform }}
4951
cache-to: type=gha,scope=${{ matrix.platform }},mode=max
5052
build-args: ENGINE_VERSION=${{ github.event.release.tag_name }}
@@ -55,24 +57,33 @@ jobs:
5557
env:
5658
LATEST_TAG: ${{ github.event.release.target_commitish == 'main' && 'thirdweb/engine:latest' || '' }}
5759
steps:
60+
- name: Set up Docker Buildx
61+
uses: docker/setup-buildx-action@v3
62+
5863
- name: Login to DockerHub
5964
uses: docker/login-action@v3
6065
with:
6166
username: ${{ secrets.DOCKER_USERNAME }}
6267
password: ${{ secrets.DOCKER_PASSWORD }}
6368

64-
- name: Create and Push Multi-arch Manifest (release tag)
69+
- name: Create and Push Multi-arch Manifest (release tag)
6570
run: |
66-
docker manifest create ${{ env.REGISTRY_IMAGE }}:${{ github.event.release.tag_name }} \
71+
docker buildx imagetools create -t ${{ env.REGISTRY_IMAGE }}:${{ github.event.release.tag_name }} \
6772
${{ env.REGISTRY_IMAGE }}:${{ github.event.release.tag_name }}-amd64 \
6873
${{ env.REGISTRY_IMAGE }}:${{ github.event.release.tag_name }}-arm64
69-
docker manifest push ${{ env.REGISTRY_IMAGE }}:${{ github.event.release.tag_name }}
70-
74+
75+
- name: Inspect release image
76+
run: |
77+
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ github.event.release.tag_name }}
7178
72-
- name: Create and Push Multi-arch Manifest (latest tag) (if applicable)
79+
- name: Create and Push Multi-arch Manifest (latest tag) (if applicable)
80+
if: ${{ env.LATEST_TAG != '' }}
81+
run: |
82+
docker buildx imagetools create -t ${{ env.REGISTRY_IMAGE }}:latest \
83+
${{ env.REGISTRY_IMAGE }}:latest-amd64 \
84+
${{ env.REGISTRY_IMAGE }}:latest-arm64
85+
86+
- name: Inspect latest image (if applicable)
7387
if: ${{ env.LATEST_TAG != '' }}
7488
run: |
75-
docker manifest create ${{ env.REGISTRY_IMAGE }}:latest \
76-
${{ env.REGISTRY_IMAGE }}:latest-arm64 \
77-
${{ env.REGISTRY_IMAGE }}:latest-amd64
78-
docker manifest push ${{ env.REGISTRY_IMAGE }}:latest
89+
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:latest

0 commit comments

Comments
 (0)