forked from Crazytieguy/trading-bootcamp-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
25 lines (22 loc) · 874 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
FROM lukemathwalker/cargo-chef:latest-rust-1-bookworm AS chef
WORKDIR /app
FROM chef AS planner
RUN rustup toolchain install nightly
COPY ./backend .
RUN cargo +nightly chef prepare --recipe-path recipe.json
FROM chef AS builder
RUN rustup toolchain install nightly
COPY --from=planner /app/recipe.json recipe.json
# Build dependencies - this is the caching Docker layer!
RUN cargo +nightly chef cook --release --recipe-path recipe.json
RUN apt-get update && apt-get install -y protobuf-compiler
# Build application
COPY ./backend .
COPY ./schema /schema
RUN cargo +nightly build --release --bin backend
# We do not need the Rust toolchain to run the binary!
FROM debian:bookworm-slim AS runtime
RUN apt-get update && apt install -y openssl ca-certificates
WORKDIR /app
COPY --from=builder /app/target/release/backend /usr/local/bin
ENTRYPOINT ["/usr/local/bin/backend"]