# ---------- Static hosting on Alpine ----------
# Pure static deployment: the pre-built site under dist/apps/web is copied
# directly into an nginx:alpine image. There is NO Node.js build stage, so the
# image is tiny and there are no npm/native-binary build steps that can fail.
#
# Before deploying, make sure dist/apps/web is up to date:
#   npm ci --include=optional --no-audit --no-fund
#   node node_modules/vite/bin/vite.js build --outDir dist/apps/web --prefix apps/web
# (or `npm run build` from the repo root), then commit dist/ and push.
FROM nginx:stable-alpine

# nginx site config: SPA fallback for React Router, gzip, asset caching.
COPY nginx.conf /etc/nginx/conf.d/default.conf

# Pre-built static site (committed to the repo).
COPY dist/apps/web /usr/share/nginx/html

EXPOSE 80
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
  CMD wget -q --spider http://127.0.0.1/ || exit 1
CMD ["nginx", "-g", "daemon off;"]
