30 lines
613 B
Docker
30 lines
613 B
Docker
# syntax=docker/dockerfile:1.7
|
|
|
|
# ---- Stage 1: Build ----
|
|
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy manifests first for cache efficiency
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci
|
|
|
|
# Copy source and build
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# ---- Stage 2: Runtime ----
|
|
FROM nginx:alpine
|
|
|
|
# Replace default config with SPA-aware one
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# Copy built static assets
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD wget -q -O /dev/null http://127.0.0.1/ || exit 1
|
|
|
|
|
|
EXPOSE 80
|