# code-sinth — static site served by nginx
# The web/ folder is fully self-contained (index.html + worklet.js).
# All JS dependencies are loaded from esm.sh via the importmap.
FROM nginx:1.27-alpine

# Replace the default nginx site config with one that serves /web/ at /,
# applies long cache for the worklet, and sets the right MIME types.
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY web/ /usr/share/nginx/html/

EXPOSE 80
# 127.0.0.1 on purpose: nginx binds IPv4 only and `localhost` may resolve to ::1
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
  CMD wget -qO- http://127.0.0.1/ >/dev/null || exit 1
