39 lines
1.5 KiB
Docker
39 lines
1.5 KiB
Docker
# ───────────────────────────────────────────────────────
|
|
# 1) Build stage: install MkDocs & compile your site
|
|
# ───────────────────────────────────────────────────────
|
|
FROM python:3.11-slim AS builder
|
|
|
|
# prevent interactive prompts
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
WORKDIR /app
|
|
|
|
# copy & install dependencies
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# copy our doc sources & build
|
|
COPY . .
|
|
# note: if you need a custom config or extra flags, adjust here
|
|
RUN mkdocs build --clean --site-dir /app/site
|
|
|
|
|
|
# ───────────────────────────────────────────────────────
|
|
# 2) Run stage: serve the built site via nginx
|
|
# ───────────────────────────────────────────────────────
|
|
FROM nginx:alpine
|
|
|
|
# remove default nginx html
|
|
RUN rm -rf /usr/share/nginx/html/*
|
|
|
|
# copy over our static site from the builder
|
|
COPY --from=builder /app/site/ /usr/share/nginx/html/
|
|
|
|
# (optional) if you have a custom nginx.conf, uncomment:
|
|
# COPY nginx.conf /etc/nginx/nginx.conf
|
|
|
|
# expose HTTP
|
|
EXPOSE 80
|
|
|
|
# run nginx in foreground
|
|
CMD ["nginx", "-g", "daemon off;"]
|