Skip to content

Commit eaf8f2c

Browse files
rlukataaustinabell
andauthored
Publish to ECR (#54)
* gh container push * add foundry (and Rust to be safe) * fix docker build yml * remove bloated cache files for CI disk space * enable fireblocks feature for prod dockerfile * fix typo from refactor * push to ecr * scope role and update repo name * update github ci * udpate ci --------- Co-authored-by: Austin Abell <[email protected]>
1 parent 963af4f commit eaf8f2c

File tree

6 files changed

+93
-21
lines changed

6 files changed

+93
-21
lines changed

Diff for: .github/CODEOWNERS

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
# Note: Order is important; the last matching pattern takes the most
44
# precedence.
55

6-
* @austinabell
6+
* @risc0/blobstream0

Diff for: .github/workflows/main.yml

+13-9
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
1-
permissions:
2-
contents: read
3-
# This configuration allows maintainers of this repo to create a branch and pull request based on
4-
# the new branch. Restricting the push trigger to the main branch ensures that the PR only gets
5-
# built once.
1+
name: Check & Test
2+
63
on:
7-
push:
8-
branches: [main]
94
pull_request:
5+
branches: main
106
workflow_dispatch:
7+
118
concurrency:
129
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
1310
cancel-in-progress: true
11+
12+
permissions:
13+
contents: read
14+
1415
env:
1516
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1617
RISC0_TOOLCHAIN_VERSION: v2024-04-22.0
1718
RISC0_MONOREPO_REF: "release-1.0"
19+
1820
jobs:
1921
check:
20-
runs-on: ubuntu-latest
22+
if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
23+
runs-on: [self-hosted, prod, Linux, X64, cpu]
2124
steps:
2225
- uses: actions/checkout@v4
2326
with:
@@ -47,7 +50,8 @@ jobs:
4750
run: |
4851
[ "$(grep -re 'DO[_ ]\?NOT[_ ]\?MERGE' $(git ls-tree --full-tree --name-only -r HEAD) | tee /dev/fd/2 | wc -l)" -eq "0" ]
4952
test:
50-
runs-on: ubuntu-latest
53+
if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
54+
runs-on: [self-hosted, prod, Linux, X64, cpu]
5155
steps:
5256
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842
5357
- name: checkout dummy commit (submodule bug workaround)

Diff for: .github/workflows/publish.yml

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Create and publish blobstream docker image
2+
3+
on:
4+
push:
5+
branches: main
6+
pull_request:
7+
branches: main
8+
9+
jobs:
10+
build-and-push-image:
11+
if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
12+
runs-on: [self-hosted, prod, Linux, X64, cpu]
13+
permissions:
14+
contents: read
15+
packages: write
16+
attestations: write
17+
id-token: write
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Install rust
23+
uses: risc0/risc0/.github/actions/rustup@main
24+
25+
# Install risczero toolchain to build the program ELF and image ID deterministically in docker.
26+
- name: risczero toolchain install
27+
run: |
28+
cargo install cargo-binstall --version '=1.6.9' --locked
29+
cargo binstall [email protected] --no-confirm --force
30+
cargo risczero install
31+
32+
- name: Install Foundry
33+
uses: risc0/foundry-toolchain@2fe7e70b520f62368a0e3c464f997df07ede420f
34+
35+
- name: cargo check to build ELF and image ID
36+
env:
37+
RISC0_USE_DOCKER: true
38+
run: cargo check
39+
40+
- name: Delete unnecessary cache files to save disk space for docker build
41+
run: sudo rm -rf "/usr/local/share/boost" "$AGENT_TOOLSDIRECTORY" ./target/debug
42+
43+
- name: configure aws credentials
44+
uses: aws-actions/configure-aws-credentials@v4
45+
with:
46+
aws-region: 'us-west-2'
47+
role-to-assume: arn:aws:iam::299470750068:role/github-actions-assume-role
48+
49+
- name: configure federated aws credentials
50+
uses: aws-actions/configure-aws-credentials@v4
51+
with:
52+
aws-region: 'us-west-2'
53+
role-to-assume: arn:aws:iam::559050242814:role/github-federated-actions-push-ecr
54+
role-chaining: true
55+
role-skip-session-tagging: true
56+
57+
- name: Login to Amazon ECR
58+
id: login-ecr
59+
uses: aws-actions/amazon-ecr-login@v2
60+
61+
- name: Build, tag, and push (if main) docker image to Amazon ECR
62+
env:
63+
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
64+
REPOSITORY: blobstream0
65+
IMAGE_TAG: ${{ github.sha }}
66+
run: |
67+
docker build -t $REGISTRY/$REPOSITORY:$IMAGE_TAG -f ./dockerfiles/blobstream0.Dockerfile .
68+
${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && 'docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG' || '' }}

Diff for: contracts/artifacts/Blobstream0.json

+9-9
Large diffs are not rendered by default.

Diff for: contracts/src/ImageID.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ pragma solidity ^0.8.20;
2020

2121
library ImageID {
2222
bytes32 public constant LIGHT_CLIENT_GUEST_ID =
23-
bytes32(0x41b09a93cf04070fad6f83c0057ec7b31d08e5047f21faa6054846d43f4dac38);
23+
bytes32(0x92a8af177f9e052feeb0809e4a68703f73cf13ce362b753293ce864e03d4dbf4);
2424
}

Diff for: dockerfiles/blobstream0.Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ WORKDIR /app
2828
COPY . .
2929

3030
# Build the project
31-
RUN cargo build -p blobstream0 --release --features prebuilt-docker
31+
RUN cargo build -p blobstream0 --release --features prebuilt-docker,fireblocks
3232

3333
# Create a new stage for a smaller final image
3434
FROM debian:bullseye-slim as final

0 commit comments

Comments
 (0)