~nickbp/originz

ref: 8151d126e7a3a2a828688d45a1af5152ca4a48da originz/Dockerfile -rw-r--r-- 986 bytes
8151d126Nick Parker Bump dependencies, clean unused args 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
# 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
COPY --from=0 /originz/target/release/originz /originz
RUN chmod +x /originz && /originz --version