-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (34 loc) · 1.07 KB
/
Dockerfile
File metadata and controls
42 lines (34 loc) · 1.07 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
# ---- Build stage ----
FROM rust:1-bookworm AS builder
RUN apt-get update && apt-get install -y --no-install-recommends \
cmake \
zlib1g-dev \
libbz2-dev \
liblzma-dev \
libcurl4-openssl-dev \
libssl-dev \
libfontconfig1-dev \
pkg-config \
clang \
&& rm -rf /var/lib/apt/lists/*
ARG GIT_SHORT_HASH=unknown
ARG CPU_TARGET=""
WORKDIR /build
COPY Cargo.toml Cargo.lock build.rs ./
COPY cpp/ cpp/
COPY src/ src/
RUN HOST_TRIPLE=$(rustc -vV | awk '/^host:/ {print $2}') && \
GIT_SHORT_HASH="${GIT_SHORT_HASH}" \
cargo build --release --target "$HOST_TRIPLE" \
${CPU_TARGET:+--config "target.'$HOST_TRIPLE'.rustflags=['-C', 'target-cpu=$CPU_TARGET']"} \
&& strip "target/$HOST_TRIPLE/release/rustqc" \
&& cp "target/$HOST_TRIPLE/release/rustqc" /rustqc
# ---- Runtime stage ----
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
fontconfig \
procps \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /rustqc /usr/local/bin/rustqc
CMD ["rustqc"]