FROM python:3.12 AS builder
RUN pip install mkdocs
WORKDIR /app
COPY . /app
ENV SITE_DIR=/app/site
RUN mkdocs build -d $SITE_DIR


FROM caddy:alpine
USER root
RUN apk add --no-cache libcap && \
    setcap -r /usr/bin/caddy && \
    chmod +x /usr/bin/caddy


COPY --from=builder /app/site /srv

USER 1000
EXPOSE 8080
CMD ["caddy", "file-server", "--listen", ":8080"]
