From f10d50422d837e32ed4abbfdf63ab4d24bf09759 Mon Sep 17 00:00:00 2001 From: Johannes Gloeckle Date: Wed, 18 Nov 2026 13:53:40 +0100 Subject: [PATCH] Auto-update website during local development Activate poll-based file watching to reload the website during local development (i.e., using `make startdocs`). The polling interval is set to two seconds which should be fast enough for development but won't cause measurable CPU load. `cleandocs` did not actually remove container images as claimed by the comment. This is fixed, too. Additionally, the `node_modules` directory is now an anonymous volume for the container to prevent `npm` in the container (over)writing to the host directory. Signed-off-by: Johannes Gloeckle --- Makefile | 12 ++++++------ hack/start-docs.sh | 8 ++++++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index c138ad5..9529d9e 100644 --- a/Makefile +++ b/Makefile @@ -4,14 +4,14 @@ # tools. (i.e. podman) CONTAINER_TOOL ?= docker -# Docker image name for the mkdocs based local development setup +# Docker image name for the VitePress based local development setup IMAGE=ironcore-dev/ironcore-dev.github.io .PHONY: startdocs -startdocs: ## Start the local mkdocs based development environment. - docker build -t $(IMAGE) -f docs/Dockerfile . --load - docker run --rm -p 5173:5173 -v `pwd`/:/app $(IMAGE) +startdocs: ## Start the local VitePress based development environment. + $(CONTAINER_TOOL) build -t $(IMAGE) -f docs/Dockerfile . --load + $(CONTAINER_TOOL) run --rm -p 5173:5173 -v `pwd`/:/app -v /app/node_modules $(IMAGE) .PHONY: cleandocs -cleandocs: ## Remove all local mkdocs Docker images (cleanup). - docker container prune --force --filter "label=project=ironcore_docs" +cleandocs: ## Remove all local VitePress Docker images (cleanup). + $(CONTAINER_TOOL) image prune --all --force --filter "label=project=ironcore_docs" diff --git a/hack/start-docs.sh b/hack/start-docs.sh index 4899de4..a1dfec2 100755 --- a/hack/start-docs.sh +++ b/hack/start-docs.sh @@ -3,6 +3,14 @@ # Install dependencies npm ci +# Enable file polling: inotify events from macOS host edits do not reach the container through +# Docker Desktop's bind mount, so live-reload only works with chokidar's polling watcher. +# +# Note on Linux polling is not required and these exports could be guarded to macOS. However, for +# simplicity, keeping it uniform. +export CHOKIDAR_USEPOLLING=true +export CHOKIDAR_INTERVAL=2000 + # Run VitePress dev server npx vitepress dev docs --host 0.0.0.0 &