@@ -15,22 +15,9 @@ concurrency:
1515
1616jobs :
1717 build-and-push :
18- name : Build & Push ${{ matrix.image.name }}
19- runs-on : ubuntu-latest
20- env :
21- IMAGE_REG : ghcr.io/${{ github.repository }}
2218 strategy :
2319 matrix :
2420 image :
25- - name : based-op-node
26- context : optimism
27- file : optimism/ops/docker/op-stack-go/Dockerfile
28- target : op-node-target
29- build-contexts : ' '
30- - name : based-op-geth
31- context : op-geth
32- file : op-geth/Dockerfile
33- build-contexts : ' '
3421 - name : based-gateway
3522 context : based
3623 file : based/gateway.Dockerfile
@@ -39,15 +26,33 @@ jobs:
3926 context : based
4027 file : based/key_to_address.Dockerfile
4128 build-contexts : ' reth=./reth'
29+ - name : based-registry
30+ context : based
31+ file : based/registry.Dockerfile
32+ build-contexts : ' reth=./reth'
33+ - name : based-portal
34+ context : based
35+ file : based/portal.Dockerfile
36+ build-contexts : ' reth=./reth'
37+ platform :
38+ - arch : amd64
39+ runner : ubuntu-latest
40+ - arch : arm64
41+ runner : ubuntu-24.04-arm
4242 fail-fast : false
4343
44+ name : Build & Push ${{ matrix.image.name }} (${{ matrix.platform.arch }})
45+ runs-on : ${{ matrix.platform.runner }}
46+ env :
47+ IMAGE_REG : ghcr.io/${{ github.repository }}
4448 steps :
4549 - uses : actions/checkout@v4
4650 with :
4751 fetch-depth : 0
4852 submodules : false
49- - uses : docker/setup-qemu-action@v3
5053 - uses : docker/setup-buildx-action@v3
54+ with :
55+ builder : multiarch-builder
5156 - uses : docker/login-action@v3
5257 with :
5358 registry : ghcr.io
@@ -56,13 +61,64 @@ jobs:
5661 - name : Build & Push ${{ matrix.image.name }}
5762 uses : docker/build-push-action@v6
5863 with :
64+ platforms : linux/${{ matrix.platform.arch }}
5965 context : ${{ matrix.image.context }}
6066 file : ${{ matrix.image.file }}
61- target : ${{ matrix.image.target }}
6267 push : true
6368 tags : |
64- ${{ env.IMAGE_REG }}/${{ matrix.image.name }}:${{ github.ref_name }}
65- ${{ !contains(github.ref_name, 'rc') && format('{0}/{1}:latest', env.IMAGE_REG, matrix.image.name) }}
66- cache-from : type=registry,ref=${{ env.IMAGE_REG }}/${{ matrix.image.name }}:buildcache
67- cache-to : type=registry,ref=${{ env.IMAGE_REG }}/${{ matrix.image.name }}:buildcache,mode=max
69+ ${{ env.IMAGE_REG }}/${{ matrix.image.name }}:${{ github.ref_name }}-${{ matrix.platform.arch }}
70+ ${{ !contains(github.ref_name, 'rc') && format('{0}/{1}:latest-{2} ', env.IMAGE_REG, matrix.image.name, matrix.platform.arch) || '' }}
71+ cache-from : type=registry,ref=${{ env.IMAGE_REG }}/${{ matrix.image.name }}:buildcache-${{ matrix.platform.arch }}
72+ cache-to : type=registry,ref=${{ env.IMAGE_REG }}/${{ matrix.image.name }}:buildcache-${{ matrix.platform.arch }} ,mode=max
6873 build-contexts : ${{ matrix.image.build-contexts }}
74+
75+ create-manifest :
76+ needs : build-and-push
77+ runs-on : ubuntu-latest
78+ strategy :
79+ matrix :
80+ image :
81+ - based-gateway
82+ - key-to-address
83+ - based-registry
84+ - based-portal
85+
86+ env :
87+ IMAGE_REG : ghcr.io/${{ github.repository }}
88+
89+ steps :
90+ - uses : docker/login-action@v3
91+ with :
92+ registry : ghcr.io
93+ username : ${{ github.actor }}
94+ password : ${{ secrets.GITHUB_TOKEN }}
95+
96+ - name : Create & Push Multi-Arch Manifests
97+ run : |
98+ ghcr="ghcr.io/${{ github.repository }}"
99+ tag="${{ github.ref_name }}"
100+ name="${{ matrix.image }}"
101+
102+ # Create and annotate versioned manifest
103+ docker manifest create \
104+ $ghcr/$name:$tag \
105+ --amend $ghcr/$name:$tag-amd64 \
106+ --amend $ghcr/$name:$tag-arm64
107+ docker manifest annotate \
108+ $ghcr/$name:$tag $ghcr/$name:$tag-amd64 --arch amd64
109+ docker manifest annotate \
110+ $ghcr/$name:$tag $ghcr/$name:$tag-arm64 --arch arm64 --variant v8
111+ docker manifest push $ghcr/$name:$tag
112+
113+ # Create and annotate latest manifest if not RC
114+ if [[ ! "$tag" =~ "rc" ]]; then
115+ docker manifest create \
116+ $ghcr/$name:latest \
117+ --amend $ghcr/$name:latest-amd64 \
118+ --amend $ghcr/$name:latest-arm64
119+ docker manifest annotate \
120+ $ghcr/$name:latest $ghcr/$name:latest-amd64 --arch amd64
121+ docker manifest annotate \
122+ $ghcr/$name:latest $ghcr/$name:latest-arm64 --arch arm64 --variant v8
123+ docker manifest push $ghcr/$name:latest
124+ fi
0 commit comments