hugo static page generator, image for command line
253
docker image for static page generator hugo - https://gohugo.io
With this image you can execute each hugo command inside the docker container. The source and destination code is mapped to container's internal directories. To avoid permission problems USER_GID and USER_UID of the host user are forwarded to container.
docker build --rm=true --tag=didlich/hugo .
assume the hugo source code is in the root directory and the generated code will reside in 'public' sub directory
the following command will print hugo version:
docker run --rm -it \
-e USER_GID=$(id -g) \
-e USER_UID=$(id -u) \
-p 8082:8082 \
-v $PWD:/src \
-v $PWD/public:/dst \
--name hugo didlich/hugo \
hugo version
the next command will start hugo's live server:
docker run --rm -it \
-e USER_GID=$(id -g) \
-e USER_UID=$(id -u) \
-p 8082:8082 \
-v $PWD:/src \
-v $PWD/public:/dst \
--name hugo didlich/hugo \
hugo server --baseURL / -b http://localhost:8082 --bind=0.0.0.0 --port 8082 --config ./config.ch.toml --source /src --destination /dst
IMPORTANT: the mapped port 8082 need to be set in hugo as --port 8082
docker run --rm -it \
-e USER_GID=$(id -g) \
-e USER_UID=$(id -u) \
-v $PWD:/src \
-v $PWD/public:/dst \
--name hugo didlich/hugo \
hugo --disableSitemap --buildDrafts --config config.toml --baseURL / --source /src --destination /dst
Content type
Image
Digest
Size
7.2 MB
Last updated
over 7 years ago
docker pull didlich/hugo