-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (31 loc) · 954 Bytes
/
Dockerfile
File metadata and controls
42 lines (31 loc) · 954 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
# Use cargo-chef for dependency caching
FROM lukemathwalker/cargo-chef:latest-rust-bookworm AS chef
WORKDIR /app
# Prepare the dependency recipe
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
# Build stage
FROM chef AS builder
# Build dependencies
COPY --from=planner /app/recipe.json recipe.json
COPY --from=planner /app/migration /app/migration
RUN cargo chef cook --release --recipe-path recipe.json
# Install dioxus-cli
RUN cargo install dioxus-cli --locked
# Copy source and build
COPY . .
RUN dx bundle --platform web --release
# Runtime image
FROM debian:bookworm-slim AS runtime
WORKDIR /app
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
libssl3 \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy the build output (binary + public assets) from builder
COPY --from=builder /app/target/dx/terrier/release/web /app
EXPOSE 3000
CMD ["/app/terrier"]