-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (30 loc) · 1.35 KB
/
Dockerfile
File metadata and controls
42 lines (30 loc) · 1.35 KB
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
# syntax=docker/dockerfile:1
# ─── Stage 1: builder ────────────────────────────────────────────────────────
FROM rust:1-bookworm AS builder
RUN apt-get update \
&& apt-get install -y --no-install-recommends pkg-config libssl-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy manifest files and pre-build all dependencies.
# This layer is re-used as long as Cargo.toml / Cargo.lock don't change.
COPY Cargo.toml Cargo.lock ./
RUN mkdir src && printf 'fn main() {}' > src/main.rs
RUN cargo build --release
RUN rm -f target/release/qsl_rs target/release/deps/qsl_rs-*
# Build the real binary.
COPY src ./src
RUN cargo build --release
# ─── Stage 2: runtime ────────────────────────────────────────────────────────
FROM debian:bookworm-slim AS runtime
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates libssl3 \
&& rm -rf /var/lib/apt/lists/*
# Install custom CA certificates from certs/.
COPY certs/ /usr/local/share/ca-certificates/
RUN update-ca-certificates
WORKDIR /app
COPY --from=builder /app/target/release/qsl_rs ./qsl_rs
EXPOSE 5236
ENV HOST=0.0.0.0
ENV PORT=5236
ENTRYPOINT ["./qsl_rs"]