-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
52 lines (32 loc) · 1.1 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
# syntax=docker/dockerfile:1
FROM rust:bookworm AS chef
# some cargo dependencies require additional packages
# to build the project.
RUN apt-get update && apt-get install -y \
g++
WORKDIR /app
RUN cargo install cargo-chef
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
WORKDIR /app
COPY --from=planner /app/recipe.json recipe.json
# Build dependencies - this is the caching Docker layer!
RUN cargo chef cook --release --recipe-path recipe.json
# copy source code and build it
COPY . .
RUN cargo build --release
FROM debian:bookworm-slim AS runtime
# to be able to use ROOT CAs file from /etc/ssl/certs/
# folder, you must install the 'ca-certificates' package
RUN apt-get update && apt-get install -y \
ca-certificates
WORKDIR /app
# to run the binary file you need:
# - environment file
COPY --from=builder /app/log4rs.yaml log4rs.yaml
COPY --from=builder /app/.env_template /.env
COPY --from=builder /app/serviceAccountKey.json_template /serviceAccountKey.json
COPY --from=builder /app/target/release/online online
ENTRYPOINT ["./online"]