# Build stage FROM python:3.9-slim AS builder # Install MkDocs, Material for MkDocs, and plugins RUN pip install --no-cache-dir mkdocs mkdocs-material mkdocs-macros-plugin # Set working directory WORKDIR /docs # Copy configuration and docs COPY mkdocs.yml . COPY docs/ ./docs/ # Validate configuration and build site with strict mode RUN mkdocs build --strict # Production stage FROM nginx:alpine # Copy the built site from the builder stage COPY --from=builder /docs/site /usr/share/nginx/html # Copy custom Nginx configuration COPY nginx.conf /etc/nginx/conf.d/default.conf # Expose port 80 EXPOSE 80 # Healthcheck to ensure Nginx is running HEALTHCHECK --interval=30s --timeout=3s \ CMD curl -f http://localhost/ || exit 1 # Start Nginx CMD ["nginx", "-g", "daemon off;"]