Automate and preview MkDocs documentation projects with Docker.
Project description
draftmk
draftmk is an advanced command-line tool that automates the setup, management, and deployment of MkDocs-based documentation projects using Docker. It streamlines local previews, environment initialization, live editing, and supports CI/CD automation with flexible repository integration and configuration scaffolding for both public and internal documentation views.
Features
- One-command environment bootstrap with optional Git initialization
- CI-friendly flags:
--no-gitto skip Git setup,--repoto link existing repositories - Automatic port assignment (avoids conflicts)
- Auto-generation of
docs/index.md,mkdocs.public.yml, andmkdocs.internal.ymlscaffolding - Colorful CLI output for improved user experience
- Automatic Docker Compose setup via GitHub Gist download
- Friendly preview logs and automatic browser launching
- Supports seamless integration into CI pipelines
Installation
Install from PyPI:
pip install draftmk
Or add to a Poetry project:
poetry add draftmk
Requires Python ≥ 3.9, Docker, and Docker Compose.
Commands
init
Bootstraps a new DraftMk project.
draftmk init [<directory>] [--no-git] [--repo <repository-url>] [--yes] [--force-git] [--template <path-or-url>]
- Prompts for a directory name (defaults to
draftmk-docsif not specified) - Creates
.draftmk/structure and.envwith available ports - Generates default
docs/index.md,mkdocs.public.yml, andmkdocs.internal.ymlfiles for scaffolding - Downloads
docker-compose.ymlfrom a GitHub Gist - Optionally initializes a Git repository on the
mainbranch unless--no-gitis specified - If
--repois provided, links the project to the existing Git repository
up
Initializes the project (if needed), pulls images, builds containers, and opens the browser.
draftmk up
--no-browser: Do not open the frontend automatically
preview
Starts the full environment and shows Docker logs.
draftmk preview --open
--open: Launches the frontend in your default browser
view
Launches the frontend in your browser using the port defined in .env.
draftmk view
--print: Only print the preview URL instead of launching the browser
logs
Tails the last 50 lines of the .draftmk/logs/draftmk.log file.
draftmk logs
stop
Stops all DraftMk-related Docker containers.
draftmk stop
status
Shows the running status of all containers.
draftmk status
scaffold
Generates a new documentation project from a Copier template.
draftmk scaffold [--template <path-or-url>] [--quiet]
--template: Specify a template path or URL (e.g.,gh:your-org/your-template)--quiet: Suppress prompts and overwrite warnings (good for CI)
By default, it uses the internal template included with DraftMk.
Usage Examples for CI Automation
To bootstrap a project without Git initialization (useful in CI pipelines):
draftmk init --no-git
To bootstrap and link to an existing repository:
draftmk init --repo yourusername/yourrepo
Directory Structure
After running draftmk init, you will have:
.
├── .draftmk/
│ ├── config/
│ ├── site/
│ │ ├── public/
│ │ └── internal/
│ └── logs/
├── docs/
│ └── index.md
├── mkdocs.public.yml
├── mkdocs.internal.yml
├── .env
└── docker-compose.yml
Docker Images
DraftMk uses pre-built Docker images hosted on Docker Hub:
- Backend:
jonmatum/draftmk-backend - Frontend:
jonmatum/draftmk-frontend - Preview:
jonmatum/draftmk-preview
Docker Compose Template
DraftMk no longer downloads a remote docker-compose.yml from a GitHub Gist.
Instead, the file is scaffolded using Copier templates (either internal or from a configured template repo).
Copier Template Support
DraftMk supports project scaffolding using Copier. You can generate a new documentation project structure using:
draftmk scaffold
By default, DraftMk uses an internal template bundled in the package.
To use a custom template instead, pass --template or define a .draftmk/settings.json file:
{
"template_repo": "gh:your-org/your-template-repo"
}
This enables full customization of how your documentation project is initialized.
Requirements
- Python ≥ 3.9
- Docker
- Docker Compose
License
MIT © Jonatan Mata
echo "Pura Vida & Happy Coding!";
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file draftmk-0.7.1.tar.gz.
File metadata
- Download URL: draftmk-0.7.1.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.13.3 Darwin/24.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16b85f9a3cb2d59edaf578003ebad22ea9e0c799783856e68ccd7fbe88c5d387
|
|
| MD5 |
614cabe5fb4954cf298c1fa46603a037
|
|
| BLAKE2b-256 |
9fcee75b1ce422ede1955d5ca0a5522ce336865ef24765ae05d01eb6bacd311c
|
File details
Details for the file draftmk-0.7.1-py3-none-any.whl.
File metadata
- Download URL: draftmk-0.7.1-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.13.3 Darwin/24.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6fc1a9e5e81a17629d5c47c41e05e15ed3193d84c52874b59ed9e061e2f7c9b3
|
|
| MD5 |
60ccb1ed4f69983603f4b7958b3084a4
|
|
| BLAKE2b-256 |
410f5d025c99356d16eb35ad24615cbbb790d517b958fcf63f5fbc170d4e15e1
|