-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (24 loc) · 1.14 KB
/
Dockerfile
File metadata and controls
33 lines (24 loc) · 1.14 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
# Stage 1: Builder
FROM rust:1.88 AS builder
# Create a new empty shell project
WORKDIR /usr/src/helios-light-client
RUN apt-get update && apt-get install -y --no-install-recommends musl-tools && rm -rf /var/lib/apt/lists/*
RUN cargo init --bin .
# Copy over the manifests
COPY ./Cargo.toml ./Cargo.lock ./
# Build dependencies for MUSL target (cache layer)
RUN rustup target add x86_64-unknown-linux-musl
RUN cargo build --release --locked --target x86_64-unknown-linux-musl
RUN rm -f target/x86_64-unknown-linux-musl/release/deps/helios_light_client*
# Copy over the source code
COPY ./src ./src
# Build the application (MUSL static)
RUN cargo build --release --locked --target x86_64-unknown-linux-musl
# Stage 2: Final image
FROM debian:bullseye-slim
# Install CA certificates for TLS (Rustls)
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates && rm -rf /var/lib/apt/lists/*
# Copy the MUSL static binary from the builder stage
COPY --from=builder /usr/src/helios-light-client/target/x86_64-unknown-linux-musl/release/helios-light-client /usr/local/bin/helios-light-client
# Set the entrypoint
CMD ["helios-light-client"]