forked from sharkAndshark/mapflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
50 lines (41 loc) · 1.42 KB
/
Dockerfile
File metadata and controls
50 lines (41 loc) · 1.42 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 Frontend
FROM node:25-alpine AS frontend-builder
WORKDIR /app/frontend
COPY frontend/package*.json ./
RUN npm ci
COPY frontend/ ./
RUN npm run build
# Stage 2: Build Backend
FROM rust:1.93-slim-bookworm AS backend-builder
WORKDIR /app
# Install build dependencies
RUN apt-get update && apt-get install -y pkg-config libssl-dev g++ && rm -rf /var/lib/apt/lists/*
COPY Cargo.toml ./
COPY backend/Cargo.toml ./backend/
COPY Cargo.lock ./
# Create a minimal target so Cargo can parse the manifest.
# This keeps dependency caching without mutating the lockfile.
RUN mkdir -p backend/src && echo "fn main() {}" > backend/src/main.rs
# Pre-fetch deps for reproducible builds
RUN cargo fetch --locked --manifest-path backend/Cargo.toml
# Build actual backend (locked)
COPY backend/src ./backend/src
RUN cargo build --release --locked --manifest-path backend/Cargo.toml
# Stage 3: Runtime
FROM debian:bookworm-slim
WORKDIR /app
# Install runtime dependencies
RUN apt-get update && apt-get install -y libssl3 ca-certificates && rm -rf /var/lib/apt/lists/*
# Copy artifacts
COPY --from=frontend-builder /app/frontend/dist ./dist
COPY --from=backend-builder /app/target/release/backend ./backend
COPY backend/extensions ./extensions
# Environment setup
ENV WEB_DIST=/app/dist
ENV UPLOAD_DIR=/app/uploads
ENV DB_PATH=/app/data/mapflow.duckdb
ENV PORT=3000
# Create directories
RUN mkdir -p /app/uploads /app/data
EXPOSE 3000
CMD ["./backend"]