forked from agglayer/agglayer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
63 lines (45 loc) · 2.31 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
FROM --platform=${BUILDPLATFORM} rust:slim-bullseye AS chef
ARG CIRCUIT_ARTIFACTS_URL_BASE=https://sp1-circuits.s3-us-east-2.amazonaws.com
ARG CIRCUIT_TYPE=plonk
ARG CIRCUIT_VERSION=v3.0.0
ARG PROTOC_VERSION=28.2
USER root
RUN cargo install cargo-chef
WORKDIR /app
FROM chef AS planner
COPY --link crates crates
COPY --link xtask xtask
# Needed for cargo-chef to build, but not use during the compilation due to `--bin agglayer`
COPY --link tests/integrations tests/integrations
COPY --link Cargo.toml Cargo.toml
COPY --link Cargo.lock Cargo.lock
RUN cargo chef prepare --recipe-path recipe.json --bin agglayer
FROM --platform=${BUILDPLATFORM} golang:1.22 AS go-builder
FROM chef AS builder
RUN apt-get update && \
apt-get --no-install-recommends install -y clang cmake curl libssl-dev tar pkg-config unzip && \
rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*
RUN ARCHITECTURE=$(uname -m | sed -e "s/arm64/arm_64/g" | sed -e "s/aarch64/aarch_64/g") \
&& curl -LOs "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-$ARCHITECTURE.zip" \
&& unzip -o "protoc-${PROTOC_VERSION}-linux-$ARCHITECTURE.zip" -d /usr/local bin/protoc \
&& unzip -o "protoc-${PROTOC_VERSION}-linux-$ARCHITECTURE.zip" -d /usr/local 'include/*' \
&& chmod +x "/usr/local/bin/protoc" \
&& rm "protoc-${PROTOC_VERSION}-linux-$ARCHITECTURE.zip"
# Install Go 1.22
COPY --from=go-builder /usr/local/go /usr/local/go
ENV PATH="/usr/local/go/bin:$PATH"
COPY --from=planner /app/recipe.json recipe.json
# Notice that we are specifying the --target flag!
RUN cargo chef cook --release --recipe-path recipe.json
COPY --link crates crates
COPY --link Cargo.toml Cargo.toml
COPY --link Cargo.lock Cargo.lock
RUN mkdir -p /root/.sp1/circuits/${CIRCUIT_TYPE}/${CIRCUIT_VERSION}
RUN curl -s -o /tmp/circuits.tar.gz ${CIRCUIT_ARTIFACTS_URL_BASE}/${CIRCUIT_VERSION}-${CIRCUIT_TYPE}.tar.gz \
&& tar -Pxzf/tmp/circuits.tar.gz -C /root/.sp1/circuits/${CIRCUIT_TYPE}/${CIRCUIT_VERSION}
RUN cargo build --release --bin agglayer
FROM --platform=${BUILDPLATFORM} debian:bullseye-slim
RUN apt-get update && apt-get install -y ca-certificates
COPY --from=builder /app/target/release/agglayer /usr/local/bin/
COPY --from=builder /root/.sp1/circuits /root/.sp1/circuits
CMD ["/usr/local/bin/agglayer"]