Docker Containerization
Relevant source files
The following files were used as context for generating this wiki page:
Docker containerization is the recommended method for developing, serving, and building the RainPPR WHK Blog. It ensures environment consistency across different platforms by encapsulating the complex technical stack, which includes Python 3.14+, uv, Node.js 20+, and specific rendering engines like KaTeX and Puppeteer.
The project utilizes a custom Docker image, ghcr.io/raineblog/mkdocs-docker, which pre-configures the necessary static site generation tools and plugins. This approach abstracts the underlying dependencies, allowing contributors to start a local preview server or build the final static site with minimal host system configuration.
Sources: README.md:95-125
Architecture and Infrastructure
The containerization strategy is centered around a unified environment that supports both development and production-like builds. The Docker image includes all necessary tools to execute the project's complex build pipeline, which involves Markdown processing, KaTeX server-side rendering, and PDF generation.
Core Components
The environment within the container is defined by the following technical specifications:
- Base Technologies: Python (version 3.14 or higher) managed by
uv, and Node.js (version 20 or higher). - Static Site Generator: MkDocs with the Material for MkDocs theme.
- Rendering Engines: KaTeX SSR for mathematical and chemical formulas, and Puppeteer for PDF export.
- Package Management:
uvfor Python dependencies andnpmfor Node.js scripts.
Sources: README.md:104-120, pyproject.toml:1-20
Build and Serve Flow
The project uses a Makefile to wrap Docker commands, providing a simplified interface for common tasks.
The diagram shows how the project abstracts Docker execution through Make commands to manage the site lifecycle.
Sources: README.md:126-150
Configuration and Environment Management
Containerized execution relies on several configuration files that define the behavior of the static site generator and the underlying plugins.
Dependency Management
The project uses pyproject.toml to define Python dependencies which are synchronized within the container using uv.
| Dependency | Purpose |
|---|---|
mkdocs-materialx | Enhanced Material theme support |
mkdocs-katex-ssr | Server-side rendering for formulas |
mkdocs-glightbox | Image lightbox effects |
mkdocs-llmstxt | LLM-friendly text generation |
mkdocs-rss-plugin | RSS feed generation |
Sources: pyproject.toml:6-20, README.md:79-92
Local Preview Configuration
When running in "serve" mode (via make serve), the project uses specific templates like scripts/template.serve.yml to configure the live-reloading environment.
This flow illustrates the configuration logic used when the container starts a local preview session.
Sources: scripts/template.serve.yml:1-135
Development Workflows within Containers
The containerized environment is not just for building; it serves as the execution context for various AI-assisted tools and maintenance scripts.
Agent and Skill Execution
AI agents and scripts defined in AGENTS.md are designed to run within the environment provided by the Docker image. This ensures that tools like autocorrect and markdownlint have access to the correct Node.js and Python versions.
| Command | Skill | Description |
|---|---|---|
make serve | Preview | Starts the Docker-based local server |
make lint | Quality | Runs Markdown linting within the container |
make export | Invokes Puppeteer/LaTeX for document export |
Sources: README.md:144-152, AGENTS.md:1-50
Workflow Orchestration
The project implements specific workflows for integrating supplemental content, which are executed using scripts that rely on the containerized environment's consistency.
The sequence diagram demonstrates the relationship between the host developer, the Docker container, and the internal script execution.
Sources: scripts/workflows/supplement-integration-v2.md:20-60, README.md:126-140
Conclusion
Docker containerization in the RainPPR WHK project serves as the foundational infrastructure for a complex documentation pipeline. By utilizing a custom image ghcr.io/raineblog/mkdocs-docker, the project ensures that all contributors have access to the exact versions of Python 3.14 and Node.js 20 required for specialized tasks like KaTeX SSR and PDF generation. This strategy significantly reduces "it works on my machine" issues and provides a stable platform for both human authors and AI agents to maintain a high-quality knowledge base.
Sources: README.md:1-160