A specialized Docker container builder for the 40docs platform that creates documentation websites using MkDocs and nginx.
The docs-builder serves as the containerization layer for documentation sites within the 40docs ecosystem. It automatically builds Docker images containing MkDocs-generated documentation sites, ready for deployment to Kubernetes clusters.
- Content Aggregation: Combines theme from
40docs/themeand content from configurable source repository (default:40docs/landing-page) - Multi-Format Generation:
- HTML documentation sites using MkDocs
- PDF generation for hands-on labs content
- Container Creation: Packages content into nginx-unprivileged containers
- Registry Management: Pushes to Azure Container Registry with semantic versioning
- GitOps Integration: Triggers downstream deployment manifests updates
- Base:
nginxinc/nginx-unprivileged:latestfor security - Health Check:
/healthz/endpoint for Kubernetes probes - Non-Root: Runs as unprivileged user (101)
- Minimal: Contains only generated documentation content
The build process can be triggered by:
- Push to main branch: Automatic builds on code changes
- Repository dispatch: External repositories can trigger builds via
docs-builderevent type - Manual workflow: GitHub Actions workflow_dispatch
ACR_LOGIN_SERVER: Azure Container Registry hostnameAZURE_CREDENTIALS: Azure service principal credentialsARM_CLIENT_ID/ARM_CLIENT_SECRET: Azure authenticationPAT: GitHub Personal Access Token for cross-repo operations
DNS_ZONE: Target domain for documentation siteMKDOCS_REPO_NAME: MkDocs container image referenceMANIFESTS_APPLICATIONS_REPO_NAME: Target repository for deployment manifestsVERSION: Current version (managed automatically)
UPSTREAM_REPO: Source repository for content (defaults to{owner}/landing-page)
Builds are triggered automatically when:
- Content is pushed to the main branch
- External repositories dispatch the
docs-builderevent - Dependencies (theme, landing-page) are updated
# Trigger via GitHub CLI
gh workflow run docs-builder.yml
# Check build status
gh workflow list
gh run list --workflow=docs-builder.yml# Build container locally (requires site/ directory with content)
mkdir -p site/
echo "<h1>Test Documentation</h1>" > site/index.html
docker build -t docs-builder-test .
docker run --rm -p 8080:8080 docs-builder-test
# Test health endpoint
curl http://localhost:8080/healthz/- Theme Repository (
40docs/theme): Provides MkDocs theme and styling - Content Repository (configurable): Source documentation content
- MkDocs Container: External container for content generation
- manifests-applications: Receives version updates
- GitOps Pipeline: Flux deployment triggered by manifest updates
- Kubernetes Cluster: Final deployment target
The builder implements intelligent semantic versioning:
- Registry Check: Queries Azure Container Registry for existing tags
- Variable Comparison: Compares with GitHub repository variables
- Version Selection: Uses higher of registry version or variable version
- Auto-Increment: Increments patch version automatically
- Cross-Repo Update: Updates deployment manifests with new version
.
├── Dockerfile # Container definition
├── .github/
│ ├── workflows/
│ │ └── docs-builder.yml # Build automation
│ └── copilot.instructions.md
└── README.md
- Changes to the Dockerfile require testing with sample content
- Workflow modifications should be tested in a fork environment
- Version changes are handled automatically - do not manually edit VERSION variables
- All builds must maintain security posture (non-root, unprivileged nginx)
# Check workflow logs
gh run view <run-id> --log
# Validate registry connectivity
dig $ACR_LOGIN_SERVER +short
az acr check-health --name <registry-name># Debug running container
docker run --rm -it <registry>/docs:latest sh
ls -la /www/
# Check health endpoint
curl -f http://localhost:8080/healthz/ || echo "Health check failed"# Check current versions
gh variable list | grep VERSION
az acr repository show-tags --name <registry> --repository docs --orderby time_desc- Uses official nginx-unprivileged base image
- Runs as non-root user (101)
- Minimal attack surface with only documentation content
- Secure Azure authentication via OIDC
- No secrets stored in container or repository
Part of the 40docs platform ecosystem. See individual component licenses for details.