# syntax=docker/dockerfile:1.7

FROM node:24-alpine AS build

WORKDIR /app

COPY package.json package-lock.json ./
RUN npm ci --ignore-scripts --no-audit --no-fund

COPY webpack.common.js webpack.config.prod.js ./
COPY index.html 404.html favicon.ico icon.png icon.svg robots.txt site.webmanifest ./
COPY css ./css
COPY img ./img
COPY js ./js
RUN npm run build

FROM nginxinc/nginx-unprivileged:1.29.4-alpine AS runtime

COPY --chown=101:101 deploy/nginx.conf /etc/nginx/conf.d/default.conf
COPY --chown=101:101 --from=build /app/dist /usr/share/nginx/html

USER 101:101

EXPOSE 8080

STOPSIGNAL SIGQUIT

HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
  CMD wget -q -O /dev/null http://127.0.0.1:8080/healthz || exit 1
