Skip to content

Commit 15446aa

Browse files
committed
fix release CI
1 parent e5edf12 commit 15446aa

File tree

5 files changed

+91
-31
lines changed

5 files changed

+91
-31
lines changed

.github/workflows/release.yml

Lines changed: 75 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,9 @@ concurrency:
1515

1616
jobs:
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

based/gateway.Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef
2+
ARG TARGETPLATFORM
3+
ARG BUILDPLATFORM
24
WORKDIR /app
35

46
RUN apt-get update && apt-get install -y clang
@@ -17,11 +19,10 @@ RUN --mount=from=reth,target=/reth cargo build --release --bin bop-gateway
1719
RUN --mount=from=reth,target=/reth cargo build --release --bin overseer
1820

1921

20-
FROM debian:stable-slim AS runtime
22+
FROM alpine:latest AS runtime
2123
WORKDIR /app
2224

23-
RUN apt-get update
24-
RUN apt-get install -y openssl ca-certificates libssl3 libssl-dev
25+
RUN apk update && apk add openssl ca-certificates
2526

2627
COPY --from=builder /app/target/release/bop-gateway /usr/local/bin
2728
COPY --from=builder /app/target/release/overseer /usr/local/bin

based/key_to_address.Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef
2+
ARG TARGETPLATFORM
3+
ARG BUILDPLATFORM
24
WORKDIR /app
35

46
RUN apt-get update && apt-get install -y clang
@@ -16,11 +18,10 @@ COPY . .
1618
RUN --mount=from=reth,target=/reth cargo build --release --bin key_to_address
1719

1820

19-
FROM debian:stable-slim AS runtime
21+
FROM alpine:latest AS runtime
2022
WORKDIR /app
2123

22-
RUN apt-get update
23-
RUN apt-get install -y openssl ca-certificates libssl3 libssl-dev
24+
RUN apk update && apk add openssl ca-certificates
2425

2526
COPY --from=builder /app/target/release/key_to_address /usr/local/bin
2627
ENTRYPOINT ["/usr/local/bin/key_to_address"]

based/portal.Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef
2+
ARG TARGETPLATFORM
3+
ARG BUILDPLATFORM
24
WORKDIR /app
35

46
RUN apt-get update && apt-get install -y clang
@@ -16,11 +18,10 @@ COPY . .
1618
RUN --mount=from=reth,target=/reth cargo build --release --bin based-portal
1719

1820

19-
FROM debian:stable-slim AS runtime
21+
FROM alpine:latest AS runtime
2022
WORKDIR /app
2123

22-
RUN apt-get update
23-
RUN apt-get install -y openssl ca-certificates libssl3 libssl-dev
24+
RUN apk update && apk add openssl ca-certificates
2425

2526
COPY --from=builder /app/target/release/based-portal /usr/local/bin
2627
ENTRYPOINT ["/usr/local/bin/based-portal"]

based/registry.Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef
2+
ARG TARGETPLATFORM
3+
ARG BUILDPLATFORM
24
WORKDIR /app
35

46
RUN apt-get update && apt-get install -y clang
@@ -16,11 +18,10 @@ COPY . .
1618
RUN --mount=from=reth,target=/reth cargo build --release --bin gateway-registry
1719

1820

19-
FROM debian:stable-slim AS runtime
21+
FROM alpine:latest AS runtime
2022
WORKDIR /app
2123

22-
RUN apt-get update
23-
RUN apt-get install -y openssl ca-certificates libssl3 libssl-dev
24+
RUN apk update && apk add openssl ca-certificates
2425

2526
COPY --from=builder /app/target/release/gateway-registry /usr/local/bin
2627
ENTRYPOINT ["/usr/local/bin/gateway-registry"]

0 commit comments

Comments
 (0)