Skip to content

Commit bc227c3

Browse files
committed
chore: decouple Go build
1 parent b07c4bd commit bc227c3

File tree

2 files changed

+60
-43
lines changed

2 files changed

+60
-43
lines changed

shared/test-utils/src/docker.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use redis::aio::ConnectionManager;
1919
use std::{
2020
env,
2121
future::Future,
22-
io::Error,
2322
process::{ExitStatus, Stdio},
2423
time::Duration,
2524
};
Lines changed: 60 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,84 @@
1-
# Global build arguments
2-
ARG BUILD_PROFILE=release
3-
ARG FEATURES="rocksdb"
4-
5-
# Stage 1: Base image with Rust
6-
FROM rust:slim-bookworm AS builder
7-
ARG BUILD_PROFILE
8-
ARG FEATURES
9-
WORKDIR /app
10-
11-
# Install build dependencies
12-
RUN --mount=type=cache,target=/var/cache/apt \
13-
--mount=type=cache,target=/var/lib/apt \
14-
apt-get update && \
15-
apt-get install -y libclang-dev pkg-config build-essential libssl-dev curl git && \
16-
rm -rf /var/lib/apt/lists/*
17-
18-
# Stage 2: Build
19-
FROM builder AS build
20-
COPY . .
21-
22-
# Install SP1 toolchain using official installer
23-
RUN curl -L https://sp1up.succinct.xyz | bash
24-
ENV PATH="/root/.sp1/bin:${PATH}"
25-
RUN sp1up
26-
27-
# Verify SP1 installation (optional)
28-
RUN cargo prove --version && \
29-
rustup toolchain list | grep succinct
30-
31-
# Build SP1 ELF program
32-
RUN cd synd-withdrawals/synd-tee-attestation-zk-proofs/sp1/program && \
33-
cargo prove build && \
34-
cd /app
35-
36-
# Perform cargo build with cached Cargo and target directories
37-
RUN --mount=type=cache,target=/usr/local/cargo,from=rust:slim-bookworm,source=/usr/local/cargo \
38-
cargo build --profile ${BUILD_PROFILE} --features "${FEATURES}" --locked
1+
## Global build arguments
2+
#ARG BUILD_PROFILE=release
3+
#ARG FEATURES="rocksdb"
4+
#
5+
## Stage 1: Base image with Rust
6+
#FROM rust:slim-bookworm AS builder
7+
#ARG BUILD_PROFILE
8+
#ARG FEATURES
9+
#WORKDIR /app
10+
#
11+
## Install build dependencies
12+
#RUN --mount=type=cache,target=/var/cache/apt \
13+
# --mount=type=cache,target=/var/lib/apt \
14+
# apt-get update && \
15+
# apt-get install -y libclang-dev pkg-config build-essential libssl-dev curl git && \
16+
# rm -rf /var/lib/apt/lists/*
17+
#
18+
## Stage 2: Build all Rust components including SP1
19+
#FROM builder AS build
20+
#COPY . .
21+
#
22+
## Install SP1 toolchain using official installer
23+
#RUN curl -L https://sp1up.succinct.xyz | bash
24+
#ENV PATH="/root/.sp1/bin:${PATH}"
25+
#RUN sp1up
26+
#
27+
## Verify SP1 installation
28+
#RUN cargo prove --version && \
29+
# rustup toolchain list | grep succinct
30+
#
31+
## Build SP1 ELF program
32+
#RUN cd synd-withdrawals/synd-tee-attestation-zk-proofs/sp1/program && \
33+
# cargo prove build && \
34+
# cd /app
35+
#
36+
## Build other Rust components if needed
37+
#RUN --mount=type=cache,target=/usr/local/cargo,from=rust:slim-bookworm,source=/usr/local/cargo \
38+
# cargo build --profile ${BUILD_PROFILE} --features "${FEATURES}" --locked
3939

4040
# --- Go build stage for synd-proposer ---
4141
FROM ghcr.io/syndicateprotocol/syndicate-appchains/node-builder AS nitro
4242

4343
FROM golang:1.23.0 AS synd-proposer-build
4444
WORKDIR /
45+
46+
# Copy dependencies
4547
COPY --from=nitro /workspace ./synd-enclave/nitro
4648
COPY ./synd-withdrawals/synd-enclave/enclave ./synd-enclave/enclave
4749
COPY ./synd-withdrawals/synd-enclave/go.mod ./synd-enclave/go.mod
4850
COPY ./synd-withdrawals/synd-enclave/go.sum ./synd-enclave/go.sum
4951
COPY ./synd-withdrawals/synd-proposer ./synd-proposer
5052

51-
# Build the Go image
53+
# Build the Go binary
5254
WORKDIR /synd-proposer
5355
RUN CGO_ENABLED=1 go build -o /go/bin/synd-proposer ./cmd/synd-proposer/main.go
5456

55-
# Run tests for synd-proposer
57+
# Run tests
5658
FROM synd-proposer-build AS synd-proposer-test
5759
WORKDIR /synd-proposer
5860
RUN go test ./...
5961

62+
# --- Runtime base ---
6063
FROM gcr.io/distroless/cc AS runtime-base
6164

62-
## Runtime images
65+
# --- Runtime image: synd-proposer ---
6366
FROM runtime-base AS synd-proposer
64-
COPY --from=synd-proposer-test /go/bin/synd-proposer /usr/local/bin/synd-proposer
67+
# Copy Go binary
68+
COPY --from=synd-proposer-build /go/bin/synd-proposer /usr/local/bin/synd-proposer
69+
# Copy SP1 ELF program from Rust build
70+
COPY --from=build /app/synd-withdrawals/synd-tee-attestation-zk-proofs/sp1/program/elf/riscv32im-succinct-zkvm-elf /sp1-elf/
71+
ENV SP1_ELF_PATH=/sp1-elf/riscv32im-succinct-zkvm-elf
6572
ENTRYPOINT ["/usr/local/bin/synd-proposer"]
6673
LABEL service=synd-proposer
74+
75+
# --- Runtime image: synd-tee-attestation (if you have a Rust binary) ---
76+
FROM runtime-base AS synd-tee-attestation
77+
ARG BUILD_PROFILE
78+
# Copy the Rust binary if you built one
79+
COPY --from=build /app/target/${BUILD_PROFILE}/synd-tee-attestation /usr/local/bin/synd-tee-attestation
80+
# Copy SP1 ELF program
81+
COPY --from=build /app/synd-withdrawals/synd-tee-attestation-zk-proofs/sp1/program/elf/riscv32im-succinct-zkvm-elf /sp1-elf/
82+
ENV SP1_ELF_PATH=/sp1-elf/riscv32im-succinct-zkvm-elf
83+
ENTRYPOINT ["/usr/local/bin/synd-tee-attestation"]
84+
LABEL service=synd-tee-attestation

0 commit comments

Comments
 (0)