https://github.com/pmudra/docker-hugo
Extremely Lightweight Docker Images for the Static Site Generator Hugo
https://github.com/pmudra/docker-hugo
alpine-image automated-build continuous-integration docker-hugo docker-image dockerfile hugo hugo-cli hugo-site static-site
Last synced: 2 months ago
JSON representation
Extremely Lightweight Docker Images for the Static Site Generator Hugo
- Host: GitHub
- URL: https://github.com/pmudra/docker-hugo
- Owner: PMudra
- License: apache-2.0
- Created: 2017-07-21T14:55:01.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-02-08T21:54:03.000Z (over 8 years ago)
- Last Synced: 2025-06-26T11:07:12.410Z (12 months ago)
- Topics: alpine-image, automated-build, continuous-integration, docker-hugo, docker-image, dockerfile, hugo, hugo-cli, hugo-site, static-site
- Language: Python
- Homepage:
- Size: 11.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Hugo Docker Images
[](https://hub.docker.com/r/pmudra/hugo/)
[](https://hub.docker.com/r/pmudra/hugo/)
[](https://hub.docker.com/r/pmudra/hugo/)
Extremely lightweight (< 10 MB) [Docker](https://www.docker.com/) images for the static site generator [Hugo](https://gohugo.io/).
## How to use this image
Basically, the Hugo Docker image is used the same way as the Hugo CLI itself.
See the official [basic usage](https://gohugo.io/getting-started/usage/) page for a more detailed explanation.
### Get help and version
```
$ docker run --rm pmudra/hugo hugo help
$ docker run --rm pmudra/hugo hugo version
```
Command/Option | Description
-----------------|------------
`docker run` | Run a command in a new container
`--rm` | Automatically remove the container when it exits
`pmudra/hugo` | Name of the Hugo Docker image
`hugo` | Execute Hugo CLI
`help`/`version` | Hugo CLI commands (i.e. same as running `hugo help`/`hugo version`)
### Create a new site
```
$ docker run --rm --mount type=bind,source="$(pwd)",target=/usr/src/myapp -w /usr/src/myapp pmudra/hugo hugo new site quickstart
```
Command/Option | Description
------------------------|------------
`--mount type=bind,` | Attach a filesystem mount to the container
`source="$(pwd)",` | Path to the directory on the host i.e. the path of the current working directory
`target=/usr/src/myapp` | Path where the directory will be mounted in the container
`-w /usr/src/myapp` | Working directory inside the container
`new site quickstart` | Create a new Hugo site named *quickstart*
The above will create a new Hugo site in a folder named *quickstart*.
### Serve content
```
$ cd quickstart
$ docker run -it --rm --mount type=bind,source="$(pwd)",target=/usr/src/myapp -w /usr/src/myapp -p 1313:1313 pmudra/hugo hugo server --bind=0.0.0.0
```
Command/Option | Description
-----------------|------------
`-it` | Keep STDIN open even if not attached and allocate a pseudo-TTY
`-p 1313:1313` | Publish the container's port to the host
`--bind=0.0.0.0` | Bind to all interfaces (this enables the docker host to access the site)
The above builds and serves the site.
Web Server is available at [http://localhost:1313/](http://localhost:1313/).
Remember to [add a theme](https://gohugo.io/getting-started/quick-start/#step-3-add-a-theme) before expecting to see anything else than a blank page.