-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (24 loc) · 929 Bytes
/
Dockerfile
File metadata and controls
33 lines (24 loc) · 929 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
FROM rust:1.91 AS build
WORKDIR /app
# 1. Create the workspace manifest
RUN echo '[workspace]\nmembers = ["messagebox"]' > Cargo.toml
# 2. Copy the Cargo.toml of the member crate
COPY messagebox/Cargo.toml ./messagebox/Cargo.toml
# 3. Copy the source code of the member crate (CRITICAL STEP)
# This ensures Cargo sees the src/ directory and valid targets
COPY messagebox/src ./messagebox/src
# 4. Now fetch dependencies
# Cargo can now parse the manifest successfully because src/ exists
RUN cargo fetch
RUN apt-get update && apt-get install libssl-dev -y
# 5. Copy the rest of the project (other crates, root files, etc.)
COPY . /app/
# 6. Build
RUN cargo build --release
# --- Runtime Stage ---
FROM debian:12-slim
RUN apt-get update && apt-get install -y libssl3 ca-certificates && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=build /app/target/release/messagebox .
EXPOSE 8081
ENTRYPOINT ["/app/messagebox"]