[Español]

docker-hugo

Table of Contents:

Docker Build Status

docker-hugo is a Dockerized Hugo CLI.

Tag Dockerfile
latest, 0.68.3 Dockerfile
0.67.1 Dockerfile
0.65.3 Dockerfile
0.65.2 Dockerfile
0.64.0 Dockerfile
0.63.2 Dockerfile
0.62.2 Dockerfile
0.61.0 Dockerfile
0.60.1 Dockerfile
0.59.1 Dockerfile
0.59.0 Dockerfile

Usage

$ docker run --rm -v /path/to/my/site/:/site/ \
  ntrrg/hugo [OPTIONS] [COMMAND]

Any command from the Hugo CLI might be used, for extra information use docker run --rm ntrrg/hugo help or see the official documentation.

Note

Since the Hugo binary from the container is called by root, it is recommendable to add the -u Docker flag.

$ docker run --rm -v /path/to/my/site/:/site/ \
  -u $(id -u $USER) \
  -v ${TMPDIR:-/tmp/}:/tmp/ \
  ntrrg/hugo [OPTIONS] [COMMAND]

Examples

  • Create a new Hugo skeleton
$ docker run --rm -v /path/to/my/site/:/site/ \
      ntrrg/hugo new site .
  • Build a Hugo project
$ docker run --rm -v /path/to/my/site/:/site/ ntrrg/hugo
  • Run the Hugo server
$ docker run --rm -i -t -p 1313:1313 \
      -v /path/to/my/site/:/site/ \
      ntrrg/hugo server -DEF --baseUrl=/ \
        --bind=0.0.0.0 --appendPort=false
  • Run the Hugo server with a custom port
$ export PORT=8080
$ docker run --rm -i -t -p $PORT:$PORT \
      -v /path/to/my/site/:/site/ \
      ntrrg/hugo server -DEF --bind=0.0.0.0 --port=$PORT \
        --baseUrl=/ --appendPort=false

Acknowledgment

Working on this project I use/used:

Websocket for LiveReload using wrong port if Hugo binds to port 80. https://github.com/gohugoio/hugo/issues/2205


Show comments

Cookies

This site uses cookies when:

If you use only Open Source products, sorry about using cookies, I will replace Disqus as my comments platform in the future.

If you use private source products, worrying about privacy and using this products is like worrying about global warming and not recycling.. So just don’t do it.. 😒