FROM git.mancheff.com/hiyv-demo/nginx-base:1.28-alpine-amd64

ARG COMMIT_ID=unknown

LABEL org.opencontainers.image.title="Hiyv nginx" \
      org.opencontainers.image.description="Hiyv-branded base nginx image" \
      org.opencontainers.image.revision="${COMMIT_ID}" \
      org.opencontainers.image.source="https://git.mancheff.com/hiyv-demo/hiyv-nginx"

COPY nginx/default.conf /etc/nginx/conf.d/default.conf
COPY web/ /usr/share/nginx/html/

RUN sed "s|@@COMMIT_ID@@|${COMMIT_ID}|g" \
      /usr/share/nginx/html/index.html.template \
      > /usr/share/nginx/html/index.html \
    && rm /usr/share/nginx/html/index.html.template

EXPOSE 80

HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
  CMD wget -qO- http://127.0.0.1/healthz || exit 1
