Skip to content

Commit 2e3c28c

Browse files
committed
build docker images for proxy
1 parent 2b7383e commit 2e3c28c

2 files changed

Lines changed: 116 additions & 10 deletions

File tree

.github/workflows/nimbus_docker_build.yml

Lines changed: 69 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@ on:
1818
- 'portal/**'
1919
- '**/*.md'
2020
- '.github/workflows/portal*.yml'
21-
- 'nimbus_verified_proxy/**'
22-
- '.github/workflows/nimbus_verified_proxy.yml'
2321

2422
workflow_dispatch:
2523

2624
env:
27-
REGISTRY_IMAGE: statusim/nimbus-eth1
25+
EL_REGISTRY_IMAGE: statusim/nimbus-eth1
26+
PROXY_REGISTRY_IMAGE: statusim/nvp
2827

2928
jobs:
3029
build:
@@ -52,11 +51,11 @@ jobs:
5251
# Replace '/' with '-' to create a unique identifier for this platform
5352
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
5453
55-
- name: Docker meta
54+
- name: Docker meta (EL)
5655
id: meta
5756
uses: docker/metadata-action@v5
5857
with:
59-
images: ${{ env.REGISTRY_IMAGE }}
58+
images: ${{ env.EL_REGISTRY_IMAGE }}
6059

6160
- name: Checkout Repository
6261
uses: actions/checkout@v4
@@ -77,7 +76,7 @@ jobs:
7776
context: .
7877
platforms: ${{ matrix.platform }}
7978
labels: ${{ steps.meta.outputs.labels }}
80-
tags: ${{ env.REGISTRY_IMAGE }}
79+
tags: ${{ env.EL_REGISTRY_IMAGE }}
8180
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
8281

8382
- name: Export digest
@@ -94,18 +93,56 @@ jobs:
9493
if-no-files-found: error
9594
retention-days: 1
9695

96+
- name: Docker meta (proxy)
97+
id: meta-proxy
98+
uses: docker/metadata-action@v5
99+
with:
100+
images: ${{ env.PROXY_REGISTRY_IMAGE }}
101+
102+
- name: Build and push proxy by digest
103+
id: build-proxy
104+
uses: docker/build-push-action@v6
105+
with:
106+
context: .
107+
file: Dockerfile.proxy
108+
platforms: ${{ matrix.platform }}
109+
labels: ${{ steps.meta-proxy.outputs.labels }}
110+
tags: ${{ env.PROXY_REGISTRY_IMAGE }}
111+
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
112+
113+
- name: Export proxy digest
114+
run: |
115+
mkdir -p ${{ runner.temp }}/proxy-digests
116+
digest="${{ steps.build-proxy.outputs.digest }}"
117+
touch "${{ runner.temp }}/proxy-digests/${digest#sha256:}"
118+
119+
- name: Upload proxy digest
120+
uses: actions/upload-artifact@v4
121+
with:
122+
name: proxy-digests-${{ env.PLATFORM_PAIR }}
123+
path: ${{ runner.temp }}/proxy-digests/*
124+
if-no-files-found: error
125+
retention-days: 1
126+
97127
merge:
98128
runs-on: ubuntu-latest
99129
needs:
100130
- build
101131
steps:
102-
- name: Download digests
132+
- name: Download el digests
103133
uses: actions/download-artifact@v4
104134
with:
105135
path: ${{ runner.temp }}/digests
106136
pattern: digests-*
107137
merge-multiple: true
108138

139+
- name: Download proxy digests
140+
uses: actions/download-artifact@v4
141+
with:
142+
path: ${{ runner.temp }}/proxy-digests
143+
pattern: proxy-digests-*
144+
merge-multiple: true
145+
109146
- name: Login to Docker Hub
110147
uses: docker/login-action@v3
111148
with:
@@ -119,7 +156,16 @@ jobs:
119156
id: meta
120157
uses: docker/metadata-action@v5
121158
with:
122-
images: ${{ env.REGISTRY_IMAGE }}
159+
images: ${{ env.EL_REGISTRY_IMAGE }}
160+
tags: |
161+
type=ref,event=branch
162+
type=sha,prefix={{branch}}-
163+
164+
- name: Docker meta (proxy)
165+
id: meta-proxy
166+
uses: docker/metadata-action@v5
167+
with:
168+
images: ${{ env.PROXY_REGISTRY_IMAGE }}
123169
tags: |
124170
type=ref,event=branch
125171
type=sha,prefix={{branch}}-
@@ -129,8 +175,21 @@ jobs:
129175
run: |
130176
jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON"
131177
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
132-
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
178+
$(printf '${{ env.EL_REGISTRY_IMAGE }}@sha256:%s ' *)
179+
180+
- name: Create proxy manifest list and push
181+
working-directory: ${{ runner.temp }}/proxy-digests
182+
env:
183+
DOCKER_METADATA_OUTPUT_JSON: ${{ steps.meta-proxy.outputs.json }}
184+
run: |
185+
jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON"
186+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
187+
$(printf '${{ env.PROXY_REGISTRY_IMAGE }}@sha256:%s ' *)
133188
134189
- name: Inspect image
135190
run: |
136-
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
191+
docker buildx imagetools inspect ${{ env.EL_REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
192+
193+
- name: Inspect proxy image
194+
run: |
195+
docker buildx imagetools inspect ${{ env.PROXY_REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}

Dockerfile.proxy

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Nimbus
2+
# Copyright (c) 2024-2026 Status Research & Development GmbH
3+
# Licensed under either of
4+
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
5+
# http://www.apache.org/licenses/LICENSE-2.0)
6+
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or
7+
# http://opensource.org/licenses/MIT)
8+
# at your option. This file may not be copied, modified, or distributed except
9+
# according to those terms.
10+
11+
FROM debian:trixie-slim AS build
12+
13+
SHELL ["/bin/bash", "-c"]
14+
15+
RUN apt-get clean && apt update \
16+
&& apt -y install curl build-essential git-lfs
17+
18+
RUN ldd --version
19+
20+
ADD . /root/nimbus-eth1
21+
22+
RUN cd /root/nimbus-eth1 \
23+
&& rm -rf build/ \
24+
&& make -j$(nproc) init \
25+
&& make -j$(nproc) DISABLE_MARCH_NATIVE=1 V=1 nimbus_verified_proxy
26+
27+
# --------------------------------- #
28+
# Starting new image to reduce size #
29+
# --------------------------------- #
30+
FROM debian:trixie-slim AS deploy
31+
32+
SHELL ["/bin/bash", "-c"]
33+
RUN apt-get clean && apt update \
34+
&& apt -y install build-essential
35+
RUN apt update && apt -y upgrade
36+
37+
RUN ldd --version
38+
39+
RUN rm -f /home/user/nimbus-eth1/build/nimbus_verified_proxy
40+
41+
COPY --from=build /root/nimbus-eth1/build/nimbus_verified_proxy /home/user/nimbus-eth1/build/nimbus_verified_proxy
42+
43+
ENV PATH="/home/user/nimbus-eth1/build:${PATH}"
44+
ENTRYPOINT ["nimbus_verified_proxy"]
45+
WORKDIR /home/user/nimbus-eth1/build
46+
47+
STOPSIGNAL SIGINT

0 commit comments

Comments
 (0)