-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (35 loc) · 1.08 KB
/
Copy pathDockerfile
File metadata and controls
44 lines (35 loc) · 1.08 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
43
44
## Rust builder
# Compile the Rust code
FROM rust:1.91.0-slim-bookworm AS rust-builder
RUN --mount=type=cache,id=apt-builder,target=/var/cache/apt,sharing=locked \
apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
clang \
cmake \
git \
lld \
pkg-config \
libssl-dev \
protobuf-compiler \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /src
COPY ./ ./
# Set build environment variables
# - Set the C/C++ compiler to clang
ENV CC=clang CXX=clang++
# - Set the Rust flags to use lld as the linker
ENV RUSTFLAGS="-C link-arg=-fuse-ld=lld"
RUN cargo build --bin dipper-service --release
## Final image
FROM debian:bookworm-slim
RUN --mount=type=cache,id=apt-runtime,target=/var/cache/apt,sharing=locked \
apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
libssl3 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install the dipper-service binary
COPY --from=rust-builder /src/target/release/dipper-service /usr/local/bin/dipper-service
ENTRYPOINT [ "dipper-service" ]