Docker Hub | GitHub | Hugo Website
0.10
0.11
0.12
0.13
0.14
0.15
0.16
0.17
0.18
0.18.1
0.19
0.20
0.20.1
,latest
(build-assets/Dockerfile)
Define a couple aliases in your .bashrc (or other relevant location) to run Hugo in a Docker container.
Note: You can pin your alias to a specific release by appending codycraven/hugo
with the Docker tag. Example: codycraven/hugo:0.18.1
alias hugo='docker run --rm -it \
-v /tmp:/tmp:Z \
-v $(pwd):/site:Z \
-w /site \
codycraven/hugo'
alias hugo-server='docker run --rm -it \
-v /tmp:/tmp:Z \
-v $(pwd):/site:Z -w /site \
-p 8080:8080 \
codycraven/hugo \
server \
--bind=0.0.0.0 \
--port=8080 \
-w'
Note: To set the port of your development site, change all three instances of 8080
to whatever port you'd like to use.
hugo --help
hugo version
hugo new site mysite
This will create a new directory under your current directory with the name of mysite
.
hugo-server
hugo
If you're new to Hugo, be sure to read the Getting Started guide. There's more you'll need to know about Hugo to effectively make use of it, such as installing/creating a theme.
This project is not involved with the Hugo project in any way. I simply love using Docker for managing my tools and love Hugo's flexibility and performance.
Lastly, if you browse the source of this repo, you'll notice there are files within the build-assets directory. The Dockerfile was written by me, Cody Craven. All other assets in that directory are from the latest release of Hugo. These assets are used by Docker Hub to automatically build the latest
tag for the Docker image.