The smallest hugo image built from Alpine.
docker pull yanqd0/hugo
There are two simple ways to use the image when developing,
docker run or
As the help of
hugo server says:
Hugo provides its own webserver which builds and serves the site.
While hugo server is high performance, it is a webserver with limited options.
Many run it in production, but the standard behavior is for people to use it
in development and use a more full featured server such as Nginx or Caddy.
hugo serverwill avoid writing the rendered and served content to disk,
preferring to store it in memory.
The default command of this docker image is
When generating the
public directory in the production environment,
please specify the command to
docker run --rm -v $PWD:/srv/hugo yanqd0/hugo hugo
If the current directory is not the hugo project, you can replace
$PWD with the path.
It may not be a convenient way to use
docker run in the development environment.
I prefer to use a docker-compose.yml file.
You can write a
docker-compose.yml in your hugo project like this:
version: '3' services: hugo: image: yanqd0/hugo volumes: - .:/srv/hugo ports: - 1313:1313
And then, run
docker-compose up -d.
There is a verified docker-compose.yml for example.
It is welcome to remind me about updates by issue.
I use the official releases instead of compiling from source, so the image is very small.
Copyright (c) 2017 Yan QiDong email@example.com