-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.backend
More file actions
48 lines (36 loc) · 1.15 KB
/
Copy pathDockerfile.backend
File metadata and controls
48 lines (36 loc) · 1.15 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# ============================================
# Stage 1: Build Rust Backend
# ============================================
FROM rust:1.85-slim-bookworm AS builder
WORKDIR /app
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy backend source
COPY backend/Cargo.toml backend/Cargo.lock ./
COPY backend/src ./src
# Downgrade incompatible dependencies and build release binary
RUN cargo update home@0.5.12 --precise 0.5.9 && \
cargo build --release
# ============================================
# Stage 2: Runtime
# ============================================
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y \
libssl3 \
ca-certificates \
curl \
postgresql-client \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy binary from builder
COPY --from=builder /app/target/release/mimic-backend /app/mimic-backend
# Copy schema for reference (optional)
COPY backend/schema.sql /app/schema.sql
# Copy entrypoint script
COPY backend/entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh
EXPOSE 3001
CMD ["/app/entrypoint.sh"]