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# Builder image
FROM rust:1-bookworm as builder
WORKDIR /usr/src/app
COPY . .
RUN cargo build --release
# Runtime image
FROM debian:bookworm-slim
WORKDIR /app
RUN apt-get update && apt-get install -y \
libssl-dev ca-certificates && \
rm -rf /var/lib/apt/lists/*
# Get compiled binary and other files from builder's cargo install directory
COPY --from=builder /usr/src/app/target/release/server .
COPY --from=builder /usr/src/app/server/config.toml ./config.toml
COPY --from=builder /usr/src/app/server/templates ./templates
COPY --from=builder /usr/src/app/server/static ./static
EXPOSE 8080
# Run the app
CMD ./server