Serve the built PWA behind your own domain: multi-stage Dockerfile builds dist/ and serves it with Caddy on :80 (TLS terminated at your Cloudflare edge). Caddyfile sets no-cache on sw.js/index/manifest and immutable on hashed assets; SPA fallback to index.html. docker-compose maps :8087. Verified locally: image builds, container serves 200s with correct cache headers and SPA fallback. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
18 lines
429 B
Docker
18 lines
429 B
Docker
# Build the PWA, then serve the static bundle with Caddy.
|
|
# TLS is terminated at your edge (Cloudflare tunnel / reverse proxy), so the
|
|
# container serves plain HTTP on :80.
|
|
|
|
# ---- build ----
|
|
FROM node:20-alpine AS build
|
|
WORKDIR /app
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# ---- serve ----
|
|
FROM caddy:2-alpine
|
|
COPY Caddyfile /etc/caddy/Caddyfile
|
|
COPY --from=build /app/dist /srv
|
|
EXPOSE 80
|