-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (38 loc) · 1007 Bytes
/
Dockerfile
File metadata and controls
51 lines (38 loc) · 1007 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
FROM rust:1-slim-bookworm as builder
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev \
libzstd-dev \
clang \
git \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Create a dummy project to cache dependencies
RUN cargo new --bin allman
WORKDIR /app/allman
# Copy manifest configuration
COPY Cargo.toml ./
# Build dependencies only (this layer is cached)
RUN cargo build --release
RUN rm src/*.rs
# Copy source code
COPY ./src ./src
# Build the actual application
# We touch main.rs to ensure a rebuild
RUN touch src/main.rs && cargo build --release
# Runtime stage
FROM debian:bookworm-slim
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
libssl3 \
libzstd1 \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy binary from builder
COPY --from=builder /app/allman/target/release/allman /app/allman
# Environment config
ENV RUST_LOG=info
EXPOSE 8000
CMD ["./allman"]