FROM hugomods/hugo:latest AS builder
COPY . /src
WORKDIR /src
RUN hugo --minify --destination /output

FROM nginx:alpine
RUN apk add --no-cache curl
COPY --from=builder /output /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
  CMD curl -f http://localhost:80/health || exit 1
