Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (31 loc) · 1.53 KB
/
Copy pathDockerfile
File metadata and controls
40 lines (31 loc) · 1.53 KB
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
#syntax=docker/dockerfile:1.7-labs
### STAGE 0: Create base chef image for building
### cargo chef is used to speed up the build process by caching dependencies using docker
### Use BUILDPLATFORM to ensure we use the native platform for building
FROM --platform=$BUILDPLATFORM rust:bookworm as chef
RUN cargo install cargo-chef
WORKDIR /app
### Stage 1: cargo chef prepare
### Creates the recipe.json file which is a manifest of Cargo.toml files and
### the relevant Cargo.lock file
FROM chef as planner
COPY --exclude=target . .
RUN cargo chef prepare
### Stage 2: Build the project
### This stage builds the deps of the project (not the code) using cargo chef cook
### and then it copies the source code and builds the actual crates
### this takes advantage of docker layer caching to the max
FROM chef as builder
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
COPY --from=planner /app/recipe.json recipe.json
RUN mkdir -p /root/.ssh
RUN ssh-keyscan github.com >> /root/.ssh/known_hosts
RUN apt-get update && apt-get -y upgrade && apt-get install -y gcc libclang-dev pkg-config libssl-dev
RUN --mount=type=ssh cargo chef cook --release --recipe-path recipe.json --bin signet
COPY --exclude=target . .
RUN --mount=type=ssh cargo build --release --bin signet
# Stage 3: Final image for running in the env
FROM --platform=$TARGETPLATFORM debian:bookworm-slim
COPY --from=builder /app/target/release/signet /usr/local/bin/signet
COPY ./.github/genesis/parmigiana-host.genesis.json /network_configs/parmigiana-host.genesis.json
CMD ["/usr/local/bin/signet", "node"]