-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
28 lines (22 loc) · 885 Bytes
/
Copy pathDockerfile
File metadata and controls
28 lines (22 loc) · 885 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
# syntax=docker/dockerfile:1.7
FROM rust:1.85-bookworm AS builder
WORKDIR /src
# Build deps for the `openssl` vendored feature.
RUN apt-get update \
&& apt-get install -y --no-install-recommends pkg-config perl make \
&& rm -rf /var/lib/apt/lists/*
# Cache dependencies in a separate layer.
COPY Cargo.toml Cargo.lock ./
RUN mkdir -p src \
&& echo "fn main() {}" > src/main.rs \
&& cargo build --release \
&& rm -rf src target/release/deps/httpbandwidthspeedtester*
COPY src ./src
RUN cargo build --release \
&& strip target/release/httpbandwidthspeedtester
FROM debian:bookworm-slim AS runtime
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /src/target/release/httpbandwidthspeedtester /usr/local/bin/httpbandwidthspeedtester
ENTRYPOINT ["/usr/local/bin/httpbandwidthspeedtester"]