- Axum backend server: health check, transfer matrix cache (base64 BYTEA), route cache (JSONB), CORS, gzip compression, tracing - Postgres schema: transfer_matrices + cached_routes tables with upserts - Dockerfile.frontend: 3-stage (wasm-pack → SvelteKit → nginx:alpine) - Dockerfile.backend: 2-stage (rust build → debian:bookworm-slim) - nginx.conf: SPA fallback, WASM mime type, /api proxy to backend - docker-compose.yml: Postgres + backend for local development - K8s manifests: namespace, frontend/backend deployments with services, ingress routing, health probes, secret-based DATABASE_URL Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
25 lines
866 B
Docker
25 lines
866 B
Docker
# Stage 1: Build WASM package
|
|
FROM rust:1.82-slim AS wasm-builder
|
|
RUN apt-get update && apt-get install -y curl pkg-config libssl-dev && rm -rf /var/lib/apt/lists/*
|
|
RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
|
WORKDIR /app
|
|
COPY Cargo.toml Cargo.lock ./
|
|
COPY crates/ crates/
|
|
RUN wasm-pack build crates/mass-driver-wasm --target web --out-dir pkg
|
|
|
|
# Stage 2: Build SvelteKit frontend
|
|
FROM node:22-slim AS frontend-builder
|
|
WORKDIR /app/frontend
|
|
COPY frontend/package.json frontend/package-lock.json ./
|
|
RUN npm ci
|
|
COPY --from=wasm-builder /app/crates/mass-driver-wasm/pkg ./node_modules/mass-driver-wasm
|
|
COPY frontend/ ./
|
|
RUN npm run build
|
|
|
|
# Stage 3: Serve with nginx
|
|
FROM nginx:alpine
|
|
COPY --from=frontend-builder /app/frontend/build /usr/share/nginx/html
|
|
COPY nginx.conf /etc/nginx/nginx.conf
|
|
EXPOSE 80
|
|
CMD ["nginx", "-g", "daemon off;"]
|