forked from lambdaclass/stabileo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (36 loc) · 1.52 KB
/
Dockerfile
File metadata and controls
54 lines (36 loc) · 1.52 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
51
52
53
54
# ── Stage 1: Build backend ────────────────────────────────────
FROM rust:1.84-bookworm AS backend-builder
WORKDIR /app
COPY Cargo.toml Cargo.lock ./
COPY engine/ engine/
COPY backend/ backend/
RUN cargo build -p dedaliano-backend --release
# ── Stage 2: Build frontend ──────────────────────────────────
FROM rust:1.84-bookworm AS wasm-builder
RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
WORKDIR /app
COPY engine/ engine/
RUN cd engine && wasm-pack build --target web --out-dir ../web-wasm --no-opt
FROM node:22-bookworm-slim AS web-builder
WORKDIR /app/web
COPY web/package.json web/package-lock.json* ./
RUN npm ci
COPY web/ .
COPY --from=wasm-builder /app/web-wasm src/lib/wasm/
RUN npm run build
# ── Stage 3: Runtime ─────────────────────────────────────────
FROM debian:bookworm-slim AS runtime
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
RUN useradd -r -s /bin/false dedaliano
WORKDIR /app
# Backend binary
COPY --from=backend-builder /app/target/release/dedaliano-backend ./backend
# Frontend static files (served by a reverse proxy or static file server)
COPY --from=web-builder /app/web/dist ./web-dist
USER dedaliano
EXPOSE 3001
ENV HOST=0.0.0.0
ENV PORT=3001
CMD ["./backend"]