2026-02-22 16:02:34 +00:00
|
|
|
# Multi-stage Dockerfile for the React dashboard.
|
|
|
|
|
# Stage 1: build the Vite/React app
|
|
|
|
|
# Stage 2: serve via nginx
|
|
|
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
# Stage 1: Node build
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
FROM node:20-alpine AS builder
|
|
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
COPY dashboard/package.json dashboard/package-lock.json ./
|
|
|
|
|
RUN npm ci
|
|
|
|
|
|
|
|
|
|
COPY dashboard/ .
|
|
|
|
|
RUN npm run build
|
|
|
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
# Stage 2: nginx to serve the static build
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
FROM nginx:alpine
|
|
|
|
|
|
|
|
|
|
# Remove default nginx site
|
|
|
|
|
RUN rm /etc/nginx/conf.d/default.conf
|
|
|
|
|
|
2026-02-25 23:46:47 +00:00
|
|
|
# Copy K8s nginx config (api-gateway on localhost since they share a pod)
|
|
|
|
|
COPY docker/nginx-k8s.conf /etc/nginx/conf.d/default.conf
|
2026-02-22 16:02:34 +00:00
|
|
|
|
|
|
|
|
# Copy built assets from the builder stage
|
|
|
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
|
|
|
|
|
|
|
|
EXPOSE 80
|
|
|
|
|
|
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|