Skip to content

Building 70 Projects ranging from beginner to advanced so anyone can — learn from, build upon, use as a reference, or even copy directly. Owned by my cybersecurity company 👇

1.0 KB
Raw Blame
# ©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;"]