-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (26 loc) · 872 Bytes
/
Dockerfile
File metadata and controls
36 lines (26 loc) · 872 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
29
30
31
32
33
34
35
36
# Build stage with cargo-chef for dependency caching
FROM rust:1.91-slim-bookworm AS chef
RUN cargo install cargo-chef
WORKDIR /usr/src/app
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config libssl-dev perl make gcc \
&& rm -rf /var/lib/apt/lists/*
# Cache dependencies
COPY --from=planner /usr/src/app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
# Copy source and build
COPY . .
RUN cargo build --release
# Runtime stage
FROM debian:bookworm-slim
WORKDIR /usr/local/bin
# Install runtime dependencies
RUN apt-get update && apt-get install -y libssl3 ca-certificates && rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/src/app/target/release/bytehub .
EXPOSE 3000
CMD ["./bytehub"]