Setup aliases for dockerized Hugo
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:
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.
Check the version of Hugo
Create a Hugo site
hugo new site mysite
This will create a new directory under your current directory with the name of
Build static files for deployment
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.