Cybersecurity-Projects/PROJECTS/advanced/ai-threat-detection/infra/docker/vite.prod

38 lines
1.0 KiB
Plaintext

# ©AngelaMos | 2026
# vite.prod
#
# Multi-stage production Dockerfile for the Vite frontend
#
# Builder stage: node:24-alpine with corepack pnpm, runs
# frozen-lockfile install and pnpm build to produce the
# dist output. Runtime stage: nginx:alpine, removes the
# default config, copies vigil.conf and the built assets
# to the nginx html root. Includes a HEALTHCHECK on /health.
# Connects to compose.yml, infra/nginx/vigil.conf
FROM node:24-alpine AS builder
RUN corepack enable && corepack prepare pnpm@latest --activate
WORKDIR /app
COPY frontend/package.json frontend/pnpm-lock.yaml* frontend/pnpm-workspace.yaml* ./
RUN pnpm install --frozen-lockfile
COPY frontend/ .
RUN pnpm build
FROM nginx:alpine
RUN rm /etc/nginx/conf.d/default.conf
COPY infra/nginx/vigil.conf /etc/nginx/conf.d/vigil.conf
COPY --from=builder /app/dist /usr/share/nginx/html
EXPOSE 80
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
CMD wget -qO- http://localhost/health || exit 1
CMD ["nginx", "-g", "daemon off;"]