# syntax=docker/dockerfile:1 # Multi-stage production container build for armonia-dashboard (Vite SPA -> Nginx Alpine) # Stage 1: Clone and build static SPA bundle from upstream Gitea repository FROM node:22-alpine AS builder RUN apk add --no-cache git && \ corepack enable && \ corepack prepare pnpm@latest --activate ARG DASHBOARD_REPO_URL="" ARG DASHBOARD_REF=main ARG VITE_API_BASE_URL=/api ENV VITE_API_BASE_URL=${VITE_API_BASE_URL} WORKDIR /app RUN test -n "${DASHBOARD_REPO_URL}" || { echo "ERROR: DASHBOARD_REPO_URL build arg is required" >&2; exit 1; } && \ git clone --depth 1 --branch "${DASHBOARD_REF}" "${DASHBOARD_REPO_URL}" . && \ pnpm install --frozen-lockfile && \ pnpm run build # Stage 2: Lightweight Nginx Alpine runtime serving static assets and proxying /api FROM nginx:1.27-alpine AS runtime COPY nginx.conf /etc/nginx/conf.d/default.conf COPY --from=builder /app/dist /usr/share/nginx/html EXPOSE 80 HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \ CMD wget -q -O /dev/null http://127.0.0.1:80/ || exit 1