25 lines
575 B
Docker
25 lines
575 B
Docker
# ---- Build stage ----
|
|
FROM node:22-alpine AS build
|
|
WORKDIR /app
|
|
|
|
# Install dependencies against the lockfile for reproducible builds
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci
|
|
|
|
# Build the static site (tsc -b && vite build -> /app/dist)
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# ---- Serve stage ----
|
|
FROM nginx:1.27-alpine AS runtime
|
|
|
|
# SPA-aware nginx config (history fallback + asset caching)
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# Static output from the build stage
|
|
COPY --from=build /app/dist /usr/share/nginx/html
|
|
|
|
EXPOSE 80
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|