Skip to content

Commit

Permalink
feat(docker): Update asterisc reproducible build image (#728)
Browse files Browse the repository at this point in the history
* feat(docker): Update asterisc reproducible build image

* add build args to release workflow
  • Loading branch information
clabby authored Oct 22, 2024
1 parent 4e07ad2 commit 1dcadbf
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 7 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/kona_fpp_docker.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
name: Build and Publish Kona FPP Images

on: [workflow_dispatch, workflow_call]
on:
workflow_dispatch:
inputs:
kona_client_tag:
description: Tag for `kona` to build `kona-client`
required: true
type: string
asterisc_tag:
description: Tag for `asterisc` to build the prestate artifacts
required: true
type: string

env:
REGISTRY: ghcr.io
Expand Down Expand Up @@ -39,3 +49,6 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
build-args: |
CLIENT_TAG=${{ inputs.kona_client_tag }}
ASTERISC_TAG=${{ inputs.asterisc_tag }}
10 changes: 5 additions & 5 deletions build/asterisc/asterisc-repro.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ RUN git clone https://github.com/ethereum-optimism/asterisc && \
git checkout $ASTERISC_TAG && \
make && \
cp rvgo/bin/asterisc /asterisc-bin

################################################################
# Build kona-client @ `CLIENT_TAG` #
################################################################
Expand All @@ -46,14 +46,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends git

# Build kona-client on the selected tag
RUN git checkout $CLIENT_TAG && \
cargo build -Zbuild-std=core,alloc --workspace --bin kona --locked --profile release-client-lto --exclude kona-host && \
cargo build -Zbuild-std=core,alloc --workspace --bin kona --locked --profile release-client-lto --exclude kona-host --exclude kona-derive-alloy && \
mv ./target/riscv64gc-unknown-none-elf/release-client-lto/kona /kona-client-elf

################################################################
# Build kona-host @ `CLIENT_TAG` #
################################################################

FROM ubuntu:22.04 AS host-build
FROM ubuntu:22.04 AS host-build
SHELL ["/bin/bash", "-c"]

ARG CLIENT_TAG
Expand All @@ -76,7 +76,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
pkg-config

# Install rust
ENV RUST_VERSION=1.80.0
ENV RUST_VERSION=1.81.0
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y --default-toolchain ${RUST_VERSION} --component rust-src
ENV PATH="/root/.cargo/bin:${PATH}"

Expand Down Expand Up @@ -123,7 +123,7 @@ RUN $ASTERISC_BIN_PATH run \
# Export Artifacts #
################################################################

FROM scratch AS export-stage
FROM ubuntu:22.04 AS export-stage

COPY --from=prestate-build /asterisc .
COPY --from=prestate-build /kona-client-elf .
Expand Down
19 changes: 18 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ build-asterisc *args='':
ghcr.io/anton-rs/kona/asterisc-builder:main cargo build --workspace -Zbuild-std=core,alloc $@ --exclude kona-host --exclude kona-derive-alloy

# Build the `kona-client` prestate artifacts for the latest release.
build-client-prestate-asterisc kona_tag asterisc_tag out='./prestate-artifacts-asterisc':
build-client-prestate-asterisc-artifacts kona_tag asterisc_tag out='./prestate-artifacts-asterisc':
#!/bin/bash
PATH_TO_REPRO_BUILDER=./build/asterisc/asterisc-repro.dockerfile
OUTPUT_DIR={{out}}
Expand All @@ -132,6 +132,23 @@ build-client-prestate-asterisc kona_tag asterisc_tag out='./prestate-artifacts-a
--build-arg ASTERISC_TAG={{asterisc_tag}} \
--platform linux/amd64 \
.

# Build the `kona-client` prestate artifacts for the latest release, with an image containing the resulting
# binaries.
build-client-prestate-asterisc-image kona_tag asterisc_tag out='./prestate-artifacts-asterisc':
#!/bin/bash
PATH_TO_REPRO_BUILDER=./build/asterisc/asterisc-repro.dockerfile
OUTPUT_DIR={{out}}

echo "Building kona-client prestate artifacts for the asterisc target. 🐚 Kona Tag: {{kona_tag}} | 🎇 Asterisc Tag: {{asterisc_tag}}"
docker build \
-f $PATH_TO_REPRO_BUILDER \
-t kona-fpp-asterisc:latest \
--build-arg CLIENT_TAG={{kona_tag}} \
--build-arg ASTERISC_TAG={{asterisc_tag}} \
--platform linux/amd64 \
.

# Clones and checks out the monorepo at the commit present in `.monorepo`
monorepo:
[ ! -d monorepo ] && git clone https://github.com/ethereum-optimism/monorepo
Expand Down

0 comments on commit 1dcadbf

Please sign in to comment.