diff --git a/.github/workflows/docker-build-lite-celo.yaml b/.github/workflows/docker-build-lite-celo.yaml new file mode 100644 index 000000000..cbf8b9841 --- /dev/null +++ b/.github/workflows/docker-build-lite-celo.yaml @@ -0,0 +1,64 @@ +name: Build Celo / OP Succinct Lite Docker Images + +on: + pull_request: + branches: + - develop + push: + branches: + - develop + workflow_dispatch: + +env: + REGISTRY_URL: us-west1-docker.pkg.dev/devopsre/dev-images/${{ github.event.repository.name }} + +jobs: + build: + name: Build OP Succinct Lite Docker Images + runs-on: + - self-hosted + - org + - 8-cpu + + permissions: + contents: read + id-token: write + security-events: write + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.sha }} # Check out the PR head, rather than the merge commit. + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta for proposer + id: meta-proposer + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY_URL }}/proposer + tags: | + type=semver,pattern={{version}} + type=edge + type=sha + type=raw,value=latest + + - name: Login at GCP Artifact Registry + uses: celo-org/reusable-workflows/.github/actions/auth-gcp-artifact-registry@v2.0 + with: + workload-id-provider: "projects/1094498259535/locations/global/workloadIdentityPools/gh-op-succinct-dev/providers/github-by-repos" + service-account: "op-succinct-gh-dev@devopsre.iam.gserviceaccount.com" + docker-gcp-registries: us-west1-docker.pkg.dev + + - name: Build and push proposer + uses: docker/build-push-action@v6 + with: + context: . + file: fault-proof/Dockerfile.proposer.celo + push: true + tags: ${{ steps.meta-proposer.outputs.tags }} + labels: ${{ steps.meta-proposer.outputs.labels }} + platforms: linux/amd64 + cache-from: type=registry,ref=${{ env.REGISTRY_URL }}/proposer-buildcache:buildcache + cache-to: type=registry,mode=max,ref=${{ env.REGISTRY_URL }}/proposer-buildcache:buildcache diff --git a/fault-proof/Dockerfile.challenger.celo b/fault-proof/Dockerfile.challenger.celo index ad416b26e..dd6886795 100644 --- a/fault-proof/Dockerfile.challenger.celo +++ b/fault-proof/Dockerfile.challenger.celo @@ -26,7 +26,10 @@ WORKDIR /app COPY . . # Build the binary -RUN cargo build --release --bin challenger --features eigenda +RUN --mount=type=cache,target=/root/.cargo/registry \ + --mount=type=cache,target=/root/.cargo/git \ + --mount=type=cache,target=/app/target \ + cargo build --release --bin challenger --features eigenda # Runtime stage FROM rust:1.89.0-trixie diff --git a/fault-proof/Dockerfile.proposer.celo b/fault-proof/Dockerfile.proposer.celo index cffe24cbb..4a9f198d3 100644 --- a/fault-proof/Dockerfile.proposer.celo +++ b/fault-proof/Dockerfile.proposer.celo @@ -2,6 +2,8 @@ FROM rust:1.89.0-trixie AS base +RUN echo $CARGO_HOME + WORKDIR /app # Install required dependencies @@ -19,6 +21,8 @@ RUN curl -L https://sp1.succinct.xyz | bash && \ ~/.sp1/bin/sp1up && \ ~/.sp1/bin/cargo-prove prove --version +COPY rust-toolchain.toml . +RUN rustup show FROM base AS builder @@ -26,7 +30,11 @@ WORKDIR /app COPY . . # Build the binary -RUN cargo build --release --bin proposer --features eigenda +RUN --mount=type=cache,target=/usr/local/cargo/registry \ + --mount=type=cache,target=/usr/local/cargo/git \ + --mount=type=cache,target=/app/target \ + cargo build --release --bin proposer --features eigenda && \ + cp target/release/proposer /app/proposer # We need to copy the binary out of the cache so that it can be referenced by the next stage. # Runtime stage FROM rust:1.89.0-trixie @@ -35,7 +43,7 @@ WORKDIR /app COPY resources/ ./resources/ # Copy the built proposer binary -COPY --from=builder /app/target/release/proposer /usr/local/bin/ +COPY --from=builder /app/proposer /usr/local/bin/ # Set the command CMD ["proposer"] diff --git a/scripts/utils/Dockerfile.game-monitor b/scripts/utils/Dockerfile.game-monitor new file mode 100644 index 000000000..1b698693e --- /dev/null +++ b/scripts/utils/Dockerfile.game-monitor @@ -0,0 +1,76 @@ +# syntax=docker/dockerfile:1.4 + +# Base stage: Install Rust and dependencies +FROM ubuntu:24.04 AS rust-base + +WORKDIR /app + +# Install required dependencies +RUN apt-get update && apt-get install -y \ + curl \ + clang \ + build-essential \ + git \ + pkg-config \ + libssl-dev \ + && rm -rf /var/lib/apt/lists/* + +# Install Rust +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +ENV PATH=/root/.cargo/bin:$PATH +RUN rustup install stable && rustup default stable + +# Install SP1 +RUN curl -L https://sp1.succinct.xyz | bash && \ + ~/.sp1/bin/sp1up -v v5.2.2 && \ + ~/.sp1/bin/cargo-prove prove --version + +# Copy toolchain file +COPY rust-toolchain.toml . +# This installs the nightly version from the file +RUN rustup show + +# Build stage +FROM rust-base AS builder + +# Copy the entire workspace +COPY . . + +# Build the cost-estimator +RUN --mount=type=cache,target=/root/.cargo/registry \ + --mount=type=cache,target=/root/.cargo/git \ + --mount=type=cache,target=/app/target \ + cargo build --release --bin cost-estimator --features eigenda +# Build the game-monitor +# RUN --mount=type=cache,target=/root/.cargo/registry \ +# --mount=type=cache,target=/root/.cargo/git \ +# --mount=type=cache,target=/app/target \ +# cargo build --release --bin game-monitor + +# Runtime stage (minimal image) +FROM ubuntu:24.04 + +WORKDIR /app + +# Install only necessary runtime dependencies +RUN apt-get update && apt-get install -y \ + curl \ + libssl-dev \ + && rm -rf /var/lib/apt/lists/* + +# Install Rust (needed by calls to cargo_metadata::MetadataCommand) +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +ENV PATH=/root/.cargo/bin:$PATH +RUN rustup install stable && rustup default stable + +# Copy toolchain file +COPY rust-toolchain.toml . +# This installs the nightly version from the file +RUN rustup show + +# Copy the built binaries +COPY --from=builder /app/target/release/cost-estimator /usr/local/bin/ +COPY --from=builder /app/target/release/game-monitor /usr/local/bin/ + +# Copy the entire workspace so we can run cargo_metadata::MetadataCommand to get the workspace root. +COPY . .