~nickbp/originz

ref: 6c95e9a8c8773fa582d45f6f9399f63a0333d8fe originz/Dockerfile -rw-r--r-- 1.1 KiB
6c95e9a8Nick Parker Include ca-certificates in docker image: for DoH upstream client 5 months ago
                                                                                
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
# Builds an image containing the binary and little else.

# Builder image, with openssl added for native-tls, and initial project for Cargo.* deps to build in

FROM docker.io/library/rust:slim
RUN apt-get update \
  && apt-get install -y libssl-dev pkg-config \
  && apt-get clean \
  && rm -rf /var/lib/apt/lists /var/cache/apt/archives \
  && cargo --version \
  && cargo install cargo-build-deps \
  && cd / \
  && cargo new --bin originz

# Build dependencies on their own as separate step to improve cached builds
# (only copy Cargo.* to avoid source changes breaking this cache)
COPY Cargo.toml Cargo.lock /originz
RUN cd /originz && cargo build-deps --release

COPY . /originz
RUN cd /originz && cargo build --release

# Release image: copy executable from builder
# Debian version needs to match builder image to avoid linker issues.

FROM docker.io/library/debian:bullseye-slim
RUN apt-get update \
  && apt-get install -y ca-certificates \
  && apt-get clean \
  && rm -rf /var/lib/apt/lists /var/cache/apt/archives
COPY --from=0 /originz/target/release/originz /originz
RUN chmod +x /originz && /originz --version