Wrapping hugo golang binary executable into a Docker image.
To get help:
docker run -it --rm zhaowde/hugo-docker:latest --help
To build the site:
docker run -it --rm -v $PWD:/src zhaowde/hugo-docker:latest
To run hugo in watching mode:
docker run -it --rm -v $PWD:/src -p 1313:1313 zhaowde/hugo-docker:latest server --bind 0.0.0.0 -D
- Go to https://github.com/gohugoio/hugo/tags, find the newest version. e.g.
v0.115.1
- Edit
Dockerfile
, update the following line to match the newest version above (without the prefixv
):ENV HUGO_VERSION=0.115.1
- Build and public the image:
docker buildx build --push --allow security.insecure --push --platform linux/amd64,linux/arm64 --builder rcplus \ --tag zhaowde/hugo-docker:0.115.1 --tag zhaowde/hugo-docker:latest --progress plain .
- In case (3) complains "ERROR: no builder "rcplus" found":
docker buildx create --bootstrap --name rcplus --driver docker-container --platform linux/amd64,linux/arm64 --use --buildkitd-flags '--allow-insecure-entitlement security.insecure'