Docker Deployment¶
This documentation site is built with MkDocs and served via nginx in Docker.
Dockerfile¶
Multi-stage build for optimal image size:
# Stage 1: Build documentation
FROM python:3.11-slim as builder
WORKDIR /build
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY mkdocs.yml .
COPY docs ./docs
RUN mkdocs build --strict --verbose
# Stage 2: Serve with nginx
FROM nginx:1.25-alpine
COPY --from=builder /build/site /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
Build Commands¶
# Build image
docker build -t oka-mkdocs:latest .
# Run locally
docker run -p 8080:80 oka-mkdocs:latest
# Test
curl http://localhost:8080/
Production¶
# Tag for GCR
docker tag oka-mkdocs:latest gcr.io/oka-gcp-004/oka-mkdocs:latest
# Push to registry
docker push gcr.io/oka-gcp-004/oka-mkdocs:latest
Image Size¶
- Base: Python 3.11 slim (~150MB) + nginx alpine (~10MB)
- MkDocs build: Static HTML (~5-10MB)
- Final image: ~20MB (alpine + static files only)