-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (26 loc) · 879 Bytes
/
Dockerfile
File metadata and controls
39 lines (26 loc) · 879 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
# 1. Build Stage
FROM rust:latest as builder
WORKDIR /app
# Install CMake (Required for rdkafka)
RUN apt-get update && apt-get install -y cmake build-essential
# Create a blank project
RUN cargo new --bin backend
WORKDIR /app/backend
# Copy manifests
COPY ./Cargo.toml ./Cargo.toml
# Build dependencies
RUN cargo build --release
RUN rm src/*.rs
# 2. Copy source code
COPY ./src ./src
# 3. Touch main to force rebuild
RUN touch src/main.rs
# 4. Build the app
RUN cargo build --release
# 5. Runtime Stage: Changed from 'bookworm-slim' to 'testing-slim'
# This provides the newer glibc version (2.38+) required by the Rust compiler
FROM debian:testing-slim
# Install OpenSSL
RUN apt-get update && apt-get install -y libssl-dev ca-certificates && rm -rf /var/lib/apt/lists/*
COPY --from=builder /app/backend/target/release/backend /usr/local/bin/backend
CMD ["backend"]