-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
29 lines (25 loc) · 933 Bytes
/
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
# syntax=docker/dockerfile:1
FROM lukemathwalker/cargo-chef:latest AS chef
WORKDIR /sns-quicknode
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
COPY --from=planner /sns-quicknode/recipe.json recipe.json
# Build dependencies - this is the caching Docker layer!
RUN mkdir -p -m 0600 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts
RUN --mount=type=ssh cargo chef cook --release --recipe-path recipe.json
# Build application
COPY src ./src
COPY Cargo.toml ./Cargo.toml
COPY Cargo.lock ./Cargo.lock
RUN --mount=type=ssh CARGO_NET_GIT_FETCH_WITH_CLI=true cargo build --release
FROM debian:bookworm-slim AS base
RUN apt-get update
RUN apt-get install -y ca-certificates
FROM base AS runtime
WORKDIR /sns-quicknode
RUN mkdir certs
COPY ./certs ./certs
COPY --from=builder /sns-quicknode/target/release/sns-quicknode /usr/local/bin
ENTRYPOINT ["/usr/local/bin/sns-quicknode"]