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 ---
4141FROM ghcr.io/syndicateprotocol/syndicate-appchains/node-builder AS nitro
4242
4343FROM golang:1.23.0 AS synd-proposer-build
4444WORKDIR /
45+
46+ # Copy dependencies
4547COPY --from=nitro /workspace ./synd-enclave/nitro
4648COPY ./synd-withdrawals/synd-enclave/enclave ./synd-enclave/enclave
4749COPY ./synd-withdrawals/synd-enclave/go.mod ./synd-enclave/go.mod
4850COPY ./synd-withdrawals/synd-enclave/go.sum ./synd-enclave/go.sum
4951COPY ./synd-withdrawals/synd-proposer ./synd-proposer
5052
51- # Build the Go image
53+ # Build the Go binary
5254WORKDIR /synd-proposer
5355RUN 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
5658FROM synd-proposer-build AS synd-proposer-test
5759WORKDIR /synd-proposer
5860RUN go test ./...
5961
62+ # --- Runtime base ---
6063FROM gcr.io/distroless/cc AS runtime-base
6164
62- # # Runtime images
65+ # --- Runtime image: synd-proposer ---
6366FROM 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
6572ENTRYPOINT ["/usr/local/bin/synd-proposer" ]
6673LABEL 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