-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathDockerfile.backend
More file actions
46 lines (26 loc) · 954 Bytes
/
Dockerfile.backend
File metadata and controls
46 lines (26 loc) · 954 Bytes
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
FROM openapitools/openapi-generator-cli:v7.18.0 AS generate
COPY ./openapi-spec ./openapi-spec
RUN openapi-generator-cli generate \
-i ./openapi-spec/openapi.yaml \
-g rust-axum \
-o /local/openapi
FROM lukemathwalker/cargo-chef:0.1.75-rust-1.93.1 AS chef
WORKDIR /app/backend
FROM chef AS planner
COPY ./app/backend .
COPY --from=generate /local/openapi ./openapi
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
COPY --from=planner /app/backend/recipe.json recipe.json
COPY --from=generate /local/openapi ./openapi
RUN cargo chef cook --recipe-path recipe.json
COPY ./app/backend .
RUN cargo build --bin backend
FROM debian:trixie-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /app/backend/target/debug/backend /usr/local/bin/backend
ENTRYPOINT ["/usr/local/bin/backend"]