-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (28 loc) · 1.43 KB
/
Dockerfile
File metadata and controls
36 lines (28 loc) · 1.43 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
FROM rust:1-bookworm AS builder
RUN apt-get update && apt-get install -y protobuf-compiler && rm -rf /var/lib/apt/lists/*
# Install ghz for gRPC benchmarking
RUN arch=$(dpkg --print-architecture) && \
case "$arch" in \
amd64) ghz_arch="x86_64" ;; \
arm64) ghz_arch="arm64" ;; \
*) echo "Unsupported architecture: $arch" && exit 1 ;; \
esac && \
curl -sSL "https://github.com/bojand/ghz/releases/download/v0.121.0/ghz-linux-${ghz_arch}.tar.gz" \
| tar xz -C /usr/local/bin ghz
WORKDIR /usr/src/app
COPY . .
# Build all server binaries
RUN cargo build --release -p examples --bin helloworld-gmf-server
RUN cargo build --release -p examples --bin helloworld-gmf-tokio-server \
--no-default-features --features gmf-tokio
RUN cargo build --release -p examples --bin helloworld-tonic-server
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y procps python3 && rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/bin/ghz /usr/local/bin/ghz
COPY --from=builder /usr/src/app/target/release/helloworld-gmf-server /usr/local/bin/
COPY --from=builder /usr/src/app/target/release/helloworld-gmf-tokio-server /usr/local/bin/
COPY --from=builder /usr/src/app/target/release/helloworld-tonic-server /usr/local/bin/
COPY examples/proto /opt/proto
COPY bench/run_benchmarks.sh /usr/local/bin/run_benchmarks.sh
RUN chmod +x /usr/local/bin/run_benchmarks.sh
ENTRYPOINT ["/usr/local/bin/run_benchmarks.sh"]