Multi-stage build: Node builds the static PWA, nginx serves it with an SPA fallback, long-lived caching for hashed assets, no-cache for the app shell and service worker, and the correct type for the web manifest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VsorPV3JeJRoZ1mD1pdvtL
14 lines
400 B
Docker
14 lines
400 B
Docker
# Build the static PWA, then serve it with nginx.
|
|
|
|
FROM node:24-alpine AS build
|
|
WORKDIR /app
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
FROM nginx:1.29-alpine
|
|
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
|
|
COPY --from=build /app/build /usr/share/nginx/html
|
|
EXPOSE 80
|
|
HEALTHCHECK --interval=30s --timeout=3s CMD wget -qO /dev/null http://127.0.0.1/ || exit 1
|