normogen/web/normogen-web/Dockerfile
goose 0d33a2c1af
Some checks failed
Lint and Build / format (push) Successful in 50s
Lint and Build / clippy (push) Successful in 2m13s
Lint and Build / build (push) Successful in 3m41s
Lint and Build / test (push) Failing after 1s
fix: rust:slim (not rust:latest-slim which doesn't exist)
2026-07-14 12:43:05 -03:00

56 lines
1.6 KiB
Docker

# Multi-stage Dockerfile for the Normogen frontend server.
#
# Stage 1: Build the Vite SPA bundle.
# Stage 2: Build the Axum frontend-server binary.
# Stage 3: Slim runtime with the binary + static files.
# ============================================================================
# Stage 1: Node — build the Vite SPA
# ============================================================================
FROM node:20-slim AS node-builder
WORKDIR /app
# Copy package files and install deps.
COPY web/normogen-web/package.json web/normogen-web/package-lock.json ./
RUN npm ci
# Copy the source and build.
COPY web/normogen-web/ ./
RUN npm run build
# ============================================================================
# Stage 2: Rust — build the frontend-server binary
# ============================================================================
FROM rust:latest AS rust-builder
WORKDIR /server
# Copy the frontend-server crate.
COPY web/frontend-server/ ./
# Build release.
RUN cargo build --release
# ============================================================================
# Stage 3: Runtime — slim image with binary + static files
# ============================================================================
FROM rust:slim
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
libssl3 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy the frontend-server binary.
COPY --from=rust-builder /server/target/release/normogen-frontend-server /app/frontend-server
# Copy the built static files.
COPY --from=node-builder /app/dist /app/dist
EXPOSE 8080
CMD ["./frontend-server"]