This document explains how the plugin is integrated into Docker images for documentation builds.
The plugin is available in two ways:
- PyPI package -
mkdocs-header-dropdown(published at https://pypi.org/project/mkdocs-header-dropdown/) - Docker image - Pre-installed in the
ghcr.io/cms-cat/mkdocs-materialimage
The Docker image is maintained in: /home/anovak/code/mkdocs-material
Key files:
Dockerfile- Builds the image with mkdocs-material and pluginsrequirements.txt- Containsmkdocs-material==9.7.0requirements-plugins.txt- Contains all MkDocs plugins includingmkdocs-header-dropdown==0.1.0
The plugin is installed via requirements-plugins.txt:
mkdocs-header-dropdown==0.1.0When the Docker image is built:
- Installs mkdocs-material from
requirements.txt - Installs all plugins from
requirements-plugins.txt(ifWITH_PLUGINS=true) - The plugin is installed from PyPI automatically
The published Docker image is available at ghcr.io/cms-cat/mkdocs-material.
Use serve.sh in the cat-docs repository:
./serve.sh [port] [host]This pulls and runs the latest published image.
For testing changes before publishing the Docker image:
-
Build the local image:
cd /home/anovak/code/mkdocs-material docker build -t mkdocs-material-local:latest .
-
Use the local image:
cd /home/anovak/code/cat-docs ./serve-local-docker.sh [port] [host]
| Script | Image Used | Purpose |
|---|---|---|
serve.sh |
ghcr.io/cms-cat/mkdocs-material (remote) |
Production use with published image |
serve-local-docker.sh |
mkdocs-material-local:latest (local) |
Testing with locally-built image |
serve-local.sh |
None (uses local Python) | Development without Docker |
When a new version of the plugin is released:
cd /home/anovak/code/mkdocs-material
# Edit requirements-plugins.txt to update version
vim requirements-plugins.txt
# Change: mkdocs-header-dropdown==0.1.0
# To: mkdocs-header-dropdown==0.2.0git add requirements-plugins.txt
git commit -m "chore: Update mkdocs-header-dropdown to 0.2.0"
git pushThis is typically automated via CI/CD when you push to the repository.
If building manually:
docker build -t ghcr.io/cms-cat/mkdocs-material:latest .
docker push ghcr.io/cms-cat/mkdocs-material:latestcd /home/anovak/code/cat-docs
# Edit requirements.txt
vim requirements.txt
# Change: mkdocs-header-dropdown~=0.1.0
# To: mkdocs-header-dropdown~=0.2.0After building the Docker image, verify the plugin is installed:
docker run --rm mkdocs-material-local:latest pip list | grep mkdocs-header-dropdownExpected output:
mkdocs-header-dropdown 0.1.0
If you see:
ERROR - Config value 'plugins': The "header-dropdown" plugin is not installed
Solution: Rebuild the Docker image with the plugin in requirements-plugins.txt
cd /home/anovak/code/mkdocs-material
docker build -t mkdocs-material-local:latest .If the wrong version is installed, check:
requirements-plugins.txthas the correct version- Docker build cache - try
docker build --no-cache - You're using the correct image (local vs remote)
In mkdocs-material repository:
Dockerfile- Docker image definitionrequirements.txt- MkDocs Material versionrequirements-plugins.txt- All plugins including mkdocs-header-dropdown
In cat-docs repository:
requirements.txt- Python dependencies (for local development)serve.sh- Uses remote Docker imageserve-local-docker.sh- Uses local Docker imageserve-local.sh- Uses local Python (no Docker)mkdocs.yml- MkDocs configuration with plugin settings
- Plugin PyPI page: https://pypi.org/project/mkdocs-header-dropdown/
- Plugin GitHub: https://github.com/cms-cat/mkdocs-header-dropdown
- Docker image: ghcr.io/cms-cat/mkdocs-material