From d28dfe2bcc48304ba47c67c52ef69c0e79dc297c Mon Sep 17 00:00:00 2001 From: Gabriele Bartolini Date: Mon, 11 May 2026 22:46:57 +1000 Subject: [PATCH 1/2] chore: document running the site via Docker Add a README section describing how to serve the site with the `hugomods/hugo` image. Closes #443 Signed-off-by: Gabriele Bartolini --- README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/README.md b/README.md index c0d3f594a..ca8892ca8 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,39 @@ npm install && npm run prod This will compile the css file into `assets/css/output.css`. This file is ignored by git, so it is generated each build. If you make changes to `assets/css/main.css` you will need to restart the hugo server (e.g. stop it and run `npm run prod`) to pick up the changes. This is a temporary fix while Hugo & Tailwind JIT learn how to play nicely together. +### Using Docker + +If you'd rather not install Hugo and Node.js locally, you can serve the +site with the +[`hugomods/hugo`](https://hub.docker.com/r/hugomods/hugo) image (the +`-node-` variant is required because this site builds CSS through +Tailwind/PostCSS): + +``` sh +docker run --rm \ + --name cnpg-www \ + -p 8080:8080 \ + -e HUGO_SECURITY_NODE_PERMISSIONS_ALLOWREAD='*' \ + -v ${PWD}:/src \ + --entrypoint sh \ + hugomods/hugo:debian-reg-dart-sass-node-git-0.161.1 \ + -c "npm install && npm run dev -- --bind 0.0.0.0 -p 8080" +``` + +The site will then be available at . + +Notes: + +- `node_modules/` is in `.gitignore`, so `npm install` writes into your + working tree and is reused across container runs. If you also run + `npm install` on the host, delete `node_modules/` before switching + between host and container (or vice versa) so the Linux-built native + binaries don't clash with the host ones. +- `HUGO_SECURITY_NODE_PERMISSIONS_ALLOWREAD='*'` widens Hugo's default + Node permission policy so `browserslist` (loaded by `postcss-preset-env`) + can walk parent directories looking for its config. +- To build without drafts, replace `npm run dev` with `npm run prod`. + ### CSS CSS is partly built by hugo & partly built outside of hugo by `npm run css`, which is called by `npm run dev|prod`. If you start to use a new Tailwind class restarting hugo is required (stop the server and `npm run dev`), if you edit `assets/style.css` it should compile in correctly without restart. This is to mitigate [this issue](https://github.com/gohugoio/hugo/issues/8343). From fe97cd0e3222aa05614b55615104b4a5e936f893 Mon Sep 17 00:00:00 2001 From: Marco Nenciarini Date: Mon, 11 May 2026 16:58:01 +0200 Subject: [PATCH 2/2] chore: polish docker run instructions Quote $(pwd) so paths with spaces survive, correct "build" to "serve" since the script runs hugo server, and note that the image tag pins Hugo 0.161.1 and should be bumped with the project. Signed-off-by: Marco Nenciarini --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ca8892ca8..dae96a8b4 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ docker run --rm \ --name cnpg-www \ -p 8080:8080 \ -e HUGO_SECURITY_NODE_PERMISSIONS_ALLOWREAD='*' \ - -v ${PWD}:/src \ + -v "$(pwd)":/src \ --entrypoint sh \ hugomods/hugo:debian-reg-dart-sass-node-git-0.161.1 \ -c "npm install && npm run dev -- --bind 0.0.0.0 -p 8080" @@ -72,7 +72,9 @@ Notes: - `HUGO_SECURITY_NODE_PERMISSIONS_ALLOWREAD='*'` widens Hugo's default Node permission policy so `browserslist` (loaded by `postcss-preset-env`) can walk parent directories looking for its config. -- To build without drafts, replace `npm run dev` with `npm run prod`. +- To serve without drafts, replace `npm run dev` with `npm run prod`. +- The image tag pins Hugo `0.161.1`; bump it as the project's Hugo version + advances. ### CSS