-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
50 lines (39 loc) · 1.17 KB
/
Dockerfile
File metadata and controls
50 lines (39 loc) · 1.17 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
49
50
# Stage 1: Build the application
FROM rust:1.85 AS chef
WORKDIR /app
RUN cargo install cargo-chef
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json
# Build dependencies - this is the caching layer
RUN cargo chef cook --release --recipe-path recipe.json
# Build application
COPY . .
RUN cargo build --release --bin PersonaForge
# Stage 2: Create the final, minimal image
FROM debian:bookworm-slim AS runtime
WORKDIR /app
# Install dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
sqlite3 \
curl \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*
# Copy the compiled binary (static files are embedded via rust_embed)
COPY --from=builder /app/target/release/PersonaForge /usr/local/bin/
# Copy migrations for database setup
COPY migrations/ /app/migrations/
# SSL certificates for reqwest
ENV SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
ENV SSL_CERT_DIR=/etc/ssl/certs
# Create data directory for database
RUN mkdir -p /app/data
# Set working directory
WORKDIR /app
# Expose webapp port
EXPOSE 8080
# Run the binary
CMD ["/usr/local/bin/PersonaForge"]