# Stdlib-only static server, so no build step and no dependencies to install.
FROM python:3.13-alpine

ENV PYTHONUNBUFFERED=1 \
    SITE_ROOT=/srv/site \
    PORT=8080

WORKDIR /srv
COPY server.py /srv/server.py
# Baked in so the image runs standalone; compose bind-mounts over this for
# live edits without a rebuild.
COPY books/ /srv/site/

RUN adduser -S -u 10001 bible
USER 10001

EXPOSE 8080

HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
  CMD python3 -c "import urllib.request as u,sys; \
sys.exit(0 if u.urlopen('http://127.0.0.1:8080/index.html',timeout=3).status==200 else 1)"

CMD ["python3", "/srv/server.py"]
