https://github.com/fundor333/docker-hugo
A Docker image for hugo
https://github.com/fundor333/docker-hugo
docker docker-image dockerfile hugo
Last synced: over 1 year ago
JSON representation
A Docker image for hugo
- Host: GitHub
- URL: https://github.com/fundor333/docker-hugo
- Owner: fundor333
- License: mit
- Created: 2017-06-24T09:36:02.000Z (almost 9 years ago)
- Default Branch: latest
- Last Pushed: 2024-04-21T09:23:35.000Z (about 2 years ago)
- Last Synced: 2025-03-18T00:45:13.646Z (over 1 year ago)
- Topics: docker, docker-image, dockerfile, hugo
- Language: Dockerfile
- Homepage:
- Size: 306 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fundor333/hugo
[]()



[](https://microbadger.com/images/fundor333/hugo "Get your own image badge on microbadger.com")
`fundor333/hugo` is a [Docker](https://www.docker.io) base image for static sites generated with [Hugo](http://gohugo.io) fork from `publysher/hugo`.
Images derived from this image can either run as a stand-alone server, or function as a volume image for your web server.
For my personal use I make smaller the image of _publysher_ because I use it in my automation service and I want a more fast pipeline.
## Prerequisites
The image is based on the following directory structure:
```txt
.
├── Dockerfile
└── site
├── config.toml
├── content
│ └── ...
├── layouts
│ └── ...
└── static
└── ...
```
In other words, your Hugo site resides in the `site` directory, and you have a simple Dockerfile:
```dockerfile
FROM fundor333/hugo
```
## Building your site
Based on this structure, you can easily build an image for your site:
```sh
docker build -t my/image .
```
Your site is automatically generated during this build.
## Using your site
There are two options for using the image you generated:
- as a stand-alone image
- as a volume image for your webserver
Using your image as a stand-alone image is the easiest:
```sh
docker run -p 1313:1313 my/image
```
This will automatically start `hugo server`, and your blog is now available on .
If you are using `boot2docker`, you need to adjust the base URL:
```sh
docker run -p 1313:1313 -e HUGO_BASE_URL=http://YOUR_DOCKER_IP:1313 my/image
```
The image is also suitable for use as a volume image for a web server, such as [nginx](https://registry.hub.docker.com/_/nginx/)
```sh
docker run -d -v /usr/share/nginx/html --name site-data my/image
docker run -d --volumes-from site-data --name site-server -p 80:80 nginx
```