-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (25 loc) · 1018 Bytes
/
Dockerfile
File metadata and controls
33 lines (25 loc) · 1018 Bytes
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
# ---- Build stage ----
FROM rust:1-bookworm AS builder
RUN apt-get update && apt-get install -y --no-install-recommends \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
ARG GIT_SHORT_HASH=unknown
ARG CPU_TARGET=""
WORKDIR /build
COPY Cargo.toml Cargo.lock build.rs ./
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/rustar-aligner" \
&& cp "target/$HOST_TRIPLE/release/rustar-aligner" /rustar-aligner
# ---- Runtime stage ----
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
procps \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /rustar-aligner /usr/local/bin/rustar-aligner
COPY --from=builder /rustar-aligner /usr/local/bin/STAR
CMD ["rustar-aligner"]