|
1 | | -FROM rust:slim-bookworm |
2 | | - |
3 | | -# Install rust nightly-2024-04-17 |
4 | | -RUN rustup toolchain install nightly-2024-04-17 |
| 1 | +FROM debian:bookworm-slim AS base |
5 | 2 |
|
6 | 3 | ARG BUILDARCH |
7 | 4 | ENV GO_VERSION=1.22.2 |
@@ -31,12 +28,121 @@ RUN go install github.com/maoueh/zap-pretty@latest |
31 | 28 | RUN go install github.com/ethereum/go-ethereum/cmd/abigen@latest |
32 | 29 | RUN go install github.com/Layr-Labs/eigenlayer-cli/cmd/eigenlayer@latest |
33 | 30 |
|
| 31 | +# Install rust |
| 32 | +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y |
| 33 | +ENV PATH="/root/.cargo/bin:${PATH}" |
| 34 | + |
34 | 35 | WORKDIR /aligned_layer |
35 | 36 |
|
36 | 37 | COPY Makefile . |
37 | | -COPY operator ./operator |
38 | | -COPY batcher/aligned-sdk ./batcher/aligned-sdk |
| 38 | +ENV CARGO_NET_GIT_FETCH_WITH_CLI=true |
| 39 | + |
| 40 | +FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef |
| 41 | + |
| 42 | +FROM chef AS planner |
| 43 | + |
| 44 | +# build_sp1_linux |
| 45 | +COPY operator/sp1/lib/Cargo.toml /aligned_layer/operator/sp1/lib/Cargo.toml |
| 46 | +COPY operator/sp1/lib/src/ /aligned_layer/operator/sp1/lib/src/ |
| 47 | +WORKDIR /aligned_layer/operator/sp1/lib |
| 48 | +RUN cargo chef prepare --recipe-path /aligned_layer/operator/sp1/lib/recipe.json |
| 49 | + |
| 50 | +# build_risc_zero_linux |
| 51 | +COPY operator/risc_zero/lib/Cargo.toml /aligned_layer/operator/risc_zero/lib/Cargo.toml |
| 52 | +COPY operator/risc_zero/lib/src/ /aligned_layer/operator/risc_zero/lib/src/ |
| 53 | +WORKDIR /aligned_layer/operator/risc_zero/lib |
| 54 | +RUN cargo chef prepare --recipe-path /aligned_layer/operator/risc_zero/lib/recipe.json |
| 55 | + |
| 56 | +# build_sp1_linux_old |
| 57 | +COPY operator/sp1_old/lib/Cargo.toml /aligned_layer/operator/sp1_old/lib/Cargo.toml |
| 58 | +COPY operator/sp1_old/lib/src/ /aligned_layer/operator/sp1_old/lib/src/ |
| 59 | +WORKDIR /aligned_layer/operator/sp1_old/lib/src/ |
| 60 | +RUN cargo chef prepare --recipe-path /aligned_layer/operator/sp1_old/lib/recipe.json |
| 61 | + |
| 62 | +# build_risc_zero_linux_old |
| 63 | +COPY operator/risc_zero_old/lib/Cargo.toml /aligned_layer/operator/risc_zero_old/lib/Cargo.toml |
| 64 | +COPY operator/risc_zero_old/lib/src/ /aligned_layer/operator/risc_zero_old/lib/src/ |
| 65 | +WORKDIR /aligned_layer/operator/risc_zero_old/lib/src/ |
| 66 | +RUN cargo chef prepare --recipe-path /aligned_layer/operator/risc_zero_old/lib/recipe.json |
| 67 | + |
| 68 | +# build_merkle_tree_linux |
| 69 | +COPY operator/merkle_tree/lib/Cargo.toml /aligned_layer/operator/merkle_tree/lib/Cargo.toml |
| 70 | +COPY operator/merkle_tree/lib/src/ /aligned_layer/operator/merkle_tree/lib/src/ |
| 71 | +WORKDIR operator/merkle_tree/lib |
| 72 | +RUN cargo chef prepare --recipe-path /aligned_layer/operator/merkle_tree/lib/recipe.json |
| 73 | + |
| 74 | +FROM chef AS chef_builder |
| 75 | + |
| 76 | +COPY batcher/aligned-sdk /aligned_layer/batcher/aligned-sdk/ |
39 | 77 |
|
| 78 | +# build_sp1_linux |
| 79 | +COPY operator/sp1/ /aligned_layer/operator/sp1/ |
| 80 | +COPY --from=planner /aligned_layer/operator/sp1/lib/recipe.json /aligned_layer/operator/sp1/lib/recipe.json |
| 81 | +WORKDIR /aligned_layer/operator/sp1/lib/ |
| 82 | +RUN cargo chef cook --release --recipe-path /aligned_layer/operator/sp1/lib/recipe.json |
| 83 | + |
| 84 | +# build_risc_zero_linux |
| 85 | +COPY operator/risc_zero/ /aligned_layer/operator/risc_zero/ |
| 86 | +COPY --from=planner /aligned_layer/operator/risc_zero/lib/recipe.json /aligned_layer/operator/risc_zero/lib/recipe.json |
| 87 | +WORKDIR /aligned_layer/operator/risc_zero/lib/ |
| 88 | +RUN cargo chef cook --release --recipe-path /aligned_layer/operator/risc_zero/lib/recipe.json |
| 89 | + |
| 90 | +# build_sp1_linux_old |
| 91 | +COPY operator/sp1_old/ /aligned_layer/operator/sp1_old/ |
| 92 | +COPY --from=planner /aligned_layer/operator/sp1_old/lib/recipe.json /aligned_layer/operator/sp1_old/lib/recipe.json |
| 93 | +WORKDIR /aligned_layer/operator/sp1_old/lib/ |
| 94 | +RUN cargo chef cook --release --recipe-path /aligned_layer/operator/sp1_old/lib/recipe.json |
| 95 | + |
| 96 | +# build_risc_zero_linux_old |
| 97 | +COPY operator/risc_zero_old/ /aligned_layer/operator/risc_zero_old/ |
| 98 | +COPY --from=planner /aligned_layer/operator/risc_zero_old/lib/recipe.json /aligned_layer/operator/risc_zero_old/lib/recipe.json |
| 99 | +WORKDIR /aligned_layer/operator/risc_zero_old/lib/ |
| 100 | +RUN cargo chef cook --release --recipe-path /aligned_layer/operator/risc_zero_old/lib/recipe.json |
| 101 | + |
| 102 | +# build_merkle_tree_linux |
| 103 | +COPY operator/merkle_tree/ /aligned_layer/operator/merkle_tree/ |
| 104 | +COPY --from=planner /aligned_layer/operator/merkle_tree/lib/recipe.json /aligned_layer/operator/merkle_tree/lib/recipe.json |
| 105 | +WORKDIR /aligned_layer/operator/merkle_tree/lib/ |
| 106 | +RUN cargo chef cook --release --recipe-path /aligned_layer/operator/merkle_tree/lib/recipe.json |
| 107 | + |
| 108 | +FROM base AS builder |
| 109 | + |
| 110 | +ENV RELEASE_FLAG=--release |
| 111 | +ENV TARGET_REL_PATH=release |
40 | 112 | ENV CARGO_NET_GIT_FETCH_WITH_CLI=true |
41 | 113 |
|
42 | | -RUN make build_all_ffi_linux |
| 114 | +COPY operator/ /aligned_layer/operator/ |
| 115 | +COPY batcher/ /aligned_layer/batcher/ |
| 116 | +COPY --from=chef_builder /aligned_layer/batcher/aligned-sdk /aligned_layer/batcher/aligned-sdk |
| 117 | + |
| 118 | +# build_sp1_linux |
| 119 | +COPY --from=chef_builder /aligned_layer/operator/sp1/lib/target/ /aligned_layer/operator/sp1/lib/target/ |
| 120 | +WORKDIR /aligned_layer/operator/sp1/lib |
| 121 | +RUN cargo build ${RELEASE_FLAG} |
| 122 | +RUN cp /aligned_layer/operator/sp1/lib/target/${TARGET_REL_PATH}/libsp1_verifier_ffi.so /aligned_layer/operator/sp1/lib/libsp1_verifier_ffi.so |
| 123 | + |
| 124 | +# build_risc_zero_linux |
| 125 | +COPY --from=chef_builder /aligned_layer/operator/risc_zero/lib/target/ /aligned_layer/operator/risc_zero/lib/target/ |
| 126 | +WORKDIR /aligned_layer/operator/risc_zero/lib |
| 127 | +RUN cargo build ${RELEASE_FLAG} |
| 128 | +RUN cp /aligned_layer/operator/risc_zero/lib/target/${TARGET_REL_PATH}/librisc_zero_verifier_ffi.so /aligned_layer/operator/risc_zero/lib/librisc_zero_verifier_ffi.so |
| 129 | + |
| 130 | +# build_sp1_linux_old |
| 131 | +COPY --from=chef_builder /aligned_layer/operator/sp1_old/lib/target/ /aligned_layer/operator/sp1_old/lib/target/ |
| 132 | +WORKDIR /aligned_layer/operator/sp1_old/lib |
| 133 | +RUN cargo build ${RELEASE_FLAG} |
| 134 | +RUN cp /aligned_layer/operator/sp1_old/lib/target/${TARGET_REL_PATH}/libsp1_verifier_old_ffi.so /aligned_layer/operator/sp1_old/lib/libsp1_verifier_old_ffi.so |
| 135 | + |
| 136 | +# build_risc_zero_linux_old |
| 137 | +COPY --from=chef_builder /aligned_layer/operator/risc_zero_old/lib/target/ /aligned_layer/operator/risc_zero_old/lib/target/ |
| 138 | +WORKDIR /aligned_layer/operator/risc_zero_old/lib |
| 139 | +RUN cargo build ${RELEASE_FLAG} |
| 140 | +RUN cp /aligned_layer/operator/risc_zero_old/lib/target/${TARGET_REL_PATH}/librisc_zero_verifier_old_ffi.so /aligned_layer/operator/risc_zero_old/lib/librisc_zero_verifier_old_ffi.so |
| 141 | + |
| 142 | + |
| 143 | +# build_merkle_tree_linux |
| 144 | +COPY --from=chef_builder /aligned_layer/operator/merkle_tree/lib/target/ /aligned_layer/operator/merkle_tree/lib/target/ |
| 145 | +WORKDIR /aligned_layer/operator/merkle_tree/lib |
| 146 | +RUN cargo build ${RELEASE_FLAG} |
| 147 | +RUN cp /aligned_layer/operator/merkle_tree/lib/target/${TARGET_REL_PATH}/libmerkle_tree.so /aligned_layer/operator/merkle_tree/lib/libmerkle_tree.so |
| 148 | +RUN cp /aligned_layer/operator/merkle_tree/lib/target/${TARGET_REL_PATH}/libmerkle_tree.a /aligned_layer/operator/merkle_tree/lib/libmerkle_tree.a |
0 commit comments