-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
36 lines (25 loc) · 1.1 KB
/
Dockerfile
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
# syntax=docker/dockerfile:1
ARG RUST_VERSION=1.82
ARG GRPC_HEALTH_PROBE_VERSION=0.4.35
FROM rust:${RUST_VERSION}-slim-bookworm AS builder
WORKDIR /home/gduck
RUN apt-get update -y \
&& apt-get install -y git g++ cmake ninja-build libssl-dev protobuf-compiler
COPY . /home/gduck
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/home/gduck/target \
cargo build --release \
&& mkdir /home/gduck/dist \
&& cp /home/gduck/target/release/gduck /home/gduck/dist
FROM builder AS probe
ARG GRPC_HEALTH_PROBE_VERSION
RUN apt-get update -y \
&& apt-get install -y wget \
&& wget -O /grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/v${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64
FROM debian:bookworm-slim
COPY --from=probe --chmod=100 /grpc_health_probe /usr/local/bin
COPY --from=builder /home/gduck/dist/gduck /gduck
ENV RUST_LOG=info RUST_BACKTRACE=1
HEALTHCHECK --interval=10s --timeout=5s --start-period=3s --retries=3 \
CMD [ "grpc_health_probe", "--addr=127.0.0.1:50051" ]
ENTRYPOINT ["/gduck", "--port", "50051"]