From d25fdbbcf713921d0565611d32d4601f23e7124d Mon Sep 17 00:00:00 2001 From: Chris C Date: Tue, 3 Feb 2026 10:10:52 -0700 Subject: [PATCH 1/2] Enhance Docker configuration for hot reloading with MkDocs --- docker-compose.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index e68d6612..1fc0edba 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,14 +1,18 @@ services: app: image: python:3.14-slim - command: mkdocs serve -a 0.0.0.0:8000 + command: python -m mkdocs serve -a 0.0.0.0:8000 --watch-theme --livereload entrypoint: /app/docker-entrypoint.sh working_dir: /app ports: - 8000:8000 volumes: - .:/app - - python-packages:/usr/local/lib/python3.14/site-packages/ + - pip-cache:/root/.cache/pip + environment: + - PYTHONUNBUFFERED=1 + stdin_open: true + tty: true volumes: - python-packages: + pip-cache: From 8cc9830812a0c9816da6b89221ee2316c6b57171 Mon Sep 17 00:00:00 2001 From: Chris C Date: Tue, 3 Feb 2026 10:13:19 -0700 Subject: [PATCH 2/2] Enhance documentation for Docker development environment with hot reloading features --- AGENTS.md | 22 ++++++++++++++++++---- README.md | 12 ++++++++++-- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 0f3fdf83..b3a8d796 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -168,11 +168,24 @@ mkdocs serve **Setup**: ```bash -# Start development server +# Start development server with hot reloading docker compose up app # Site available at http://localhost:8000 -# Hot-reloading enabled for development +``` + +**Features**: +- **Hot Reloading**: File changes in `docs/` or `mkdocs.yml` automatically trigger a rebuild and browser refresh +- **Pip Cache**: Python packages are cached in a Docker volume (`pip-cache`) for faster subsequent starts +- **Theme Watching**: The `--watch-theme` flag enables detection of theme file changes + +**Stopping the Server**: +```bash +# Stop containers (preserves pip cache) +docker compose down + +# Stop containers and remove all volumes (clears pip cache) +docker compose down -v ``` ### Testing Changes @@ -359,8 +372,9 @@ mkdocs gh-deploy --force # Force deploy (used by CI) mkdocs -h # Show help # Docker -docker compose up app # Start development server in Docker -docker compose down # Stop Docker containers +docker compose up app # Start development server with hot reloading +docker compose down # Stop containers (preserves pip cache) +docker compose down -v # Stop containers and clear pip cache # Create new post ./create_post.sh # Create post for next Tuesday (bash) diff --git a/README.md b/README.md index 9e74f04b..d07ec7fb 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,14 @@ This is a static site built with [MkDocs Material](https://squidfunk.github.io/m 2. Open your browser to [http://localhost:8000](http://localhost:8000) -The site will automatically reload when you make changes to the content. +**Hot Reloading**: The Docker development environment supports hot reloading out of the box. When you edit any file in the `docs/` directory (or `mkdocs.yml`), the site will automatically rebuild and your browser will refresh to show the changes. + +**Pip Cache**: Python packages are cached in a Docker volume (`pip-cache`), so subsequent container starts are faster since packages don't need to be re-downloaded. + +To stop the server, press `Ctrl+C`. To completely remove containers and volumes: +```bash +docker compose down -v +``` ## Creating Blog Posts @@ -143,8 +150,9 @@ mkdocs build --clean # Clean build mkdocs -h # Show help # Docker -docker compose up app # Start development server +docker compose up app # Start development server (with hot reloading) docker compose down # Stop containers +docker compose down -v # Stop containers and remove volumes (pip cache) ``` ## Deployment