Skip to content

Commit 2b46bcc

Browse files
committed
add dockerfile
1 parent 1f9b6fe commit 2b46bcc

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
FROM rust as planner
2+
WORKDIR app
3+
# We only pay the installation cost once,
4+
# it will be cached from the second build onwards
5+
# To ensure a reproducible build consider pinning
6+
# the cargo-chef version with `--version X.X.X`
7+
RUN cargo install cargo-chef
8+
9+
COPY . .
10+
11+
RUN cargo chef prepare --recipe-path recipe.json
12+
13+
FROM rust as cacher
14+
WORKDIR app
15+
RUN cargo install cargo-chef
16+
COPY --from=planner /app/recipe.json recipe.json
17+
RUN --mount=type=ssh cargo chef cook --release --recipe-path recipe.json
18+
19+
FROM rust as builder
20+
WORKDIR app
21+
COPY . .
22+
# Copy over the cached dependencies
23+
COPY --from=cacher /app/target target
24+
COPY --from=cacher /usr/local/cargo /usr/local/cargo
25+
RUN --mount=type=ssh cargo build --release --bin reporting
26+
27+
FROM debian:buster-slim as runtime
28+
WORKDIR app
29+
COPY --from=builder /app/target/release/reporting /usr/local/bin
30+
RUN apt-get update && apt-get -y install ca-certificates libssl-dev && rm -rf /var/lib/apt/lists/*
31+
ENTRYPOINT ["/usr/local/bin/reporting"]

0 commit comments

Comments
 (0)