Sign inSign up

ssgaas/hugo

By ssgaas

•Updated over 9 years ago

Docker image for hugo static page generator https://gohugo.io.

Image
1

1.2K

ssgaas/hugo repository overview

⁠docker-hugoSEU

Docker image for hugo static page generator https://gohugo.io⁠.

This container is designed to be used as part of a continuous deployment process to build any hugo based site inside a container and separating the build from other processess work.

It is also highly configurable using different environment variables before running it. You can also find the latest version and history at its docker hub page:

https://hub.docker.com/r/ssgaas/hugo⁠

⁠Environment Variables

The container it is hightly configurable using environment variables. The following is a list of the ones that can be used right now:

⁠SOURCE_REPOSITORY

Repository where the sources are. That will be a Git URL where the source code of the hugo based site is.

Example: https://github.com/ssgaas/samplesite.git

#### SOURCE_BRANCH

Branch of the source code that is going to be fetched. Currently only one at once branch is supported (the one who's results are going to be deployed).

Example: branch

⁠HUGO_THEME

Theme name. Found a list here http://themes.gohugo.io/⁠

Example: blackburn

⁠HUGO_BASE_URL

Base URL to resolve links a.k.a the hostname (and path) to the root.

Example: http://mysite.com:8080/blog/

⁠Executing the container

Executing the container can be like this:

$ docker run \
  --name "my-hugo" \
  --env SOURCE_BRANCH='master' \
  --env SOURCE_REPOSITORY='https://github.com/ssgaas/samplesite.git' \
  --env HUGO_THEME='blackburn' \
  --env HUGO_BASE_URL='http://mysite.com:8080/blog/' \
  --rm \
  ssgaas/hugo

Find your container:

$ docker ps | grep "my-hugo"
CONTAINER ID        IMAGE                COMMAND                CREATED             STATUS              PORTS         NAMES
ba00b5c238fc        ssgaas/hugo:latest   "/run.sh"              7 seconds ago       Up 6 seconds        1313/tcp      my-hugo

⁠Building The Image Yourself (optional)

docker build --force-rm --tag ssgaas/hugo:latest .

The image is conveniently small at about 43.05 MB thanks to alpine⁠:

docker images | grep hugo
ssgaas/hugo:0.17   latest              b2e7a8364baa        1 second ago      43.05 MB

⁠Creating a new tag

Create a new git branch, change the line ENV HUGO_VERSION=0.17 in Dockerfile and wire it in the Docker Hub accordingly.

Tag summary

Content type

Image

Digest

Size

18.8 MB

Last updated

over 9 years ago

docker pull ssgaas/hugo