26 lines
651 B
Docker
26 lines
651 B
Docker
# syntax=docker/dockerfile:1
|
|
|
|
# --- Build stage ---------------------------------------------------------
|
|
FROM node:22-alpine AS build
|
|
WORKDIR /app
|
|
|
|
# Install dependencies first for better layer caching.
|
|
COPY package*.json ./
|
|
RUN npm ci
|
|
|
|
# Build the static site (outputs to /app/dist).
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# --- Serve stage ---------------------------------------------------------
|
|
FROM nginx:alpine AS serve
|
|
|
|
# SPA-aware nginx config (client-side routing fallback).
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# Copy the built static assets.
|
|
COPY --from=build /app/dist /usr/share/nginx/html
|
|
|
|
EXPOSE 80
|
|
CMD ["nginx", "-g", "daemon off;"]
|