Skip to content

A Docker container with the Hugo static web site generator local server configuration

Notifications You must be signed in to change notification settings

devopsdays/docker-hugo-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker-hugo-server

This repository supplies the Docker Hub container located at https://hub.docker.com/r/devopsdays/docker-hugo-server/ . Docker Hub will automatically update the creation of the Docker image when it detects any changes made to this repository.

devopsdays/docker-hugo-server is an installation of Hugo release 0.30.2 running on Alpine Linux release 3.4.

devopsdays/docker-hugo-server

Docker image that runs the Hugo static web site compiler as a dynamic server to enable local development of a static web site using Markdown description located in a directory.

Use this Docker container instead of installing Hugo directly on your computer. This will keep Hugo and its dependencies separate from any software you have installed.

The file hugoServer is provided as an example run script to run the Hugo website from within this image. The command to run the server from the root directory of the web site is:

docker run -p 1313:1313 -e VIRTUAL_HOST="${1}" --name hugo-server devopsdays/docker-hugo-server .

The options are:

  • -d runs the container in detached mode (continuous server).

  • -p maps the port inside of the Docker container to an externally accessible port. In this case port 1313 is mapped to port 1313.

  • -e sets the environment variable VIRTUAL_HOST within the container. This is the URL for the website which is included in various ways in the generated web site source code.

  • --name provides a permanent name to the container so that it can be later deleted or otherwise managed.

  • The . (dot) signifies that the present working directory is the root of the website defined using Markdown following Hugo directives.

Usage

Create a directory in your computer, place a normal Hugo website definition and run the command (above). The result is that a local website is run and can be accessed from http://localhost:1313.

NB: You may need to use ```-e VIRTUL_HOST="http://docker.local:1313"

Credits

Based upon databliss/docker-hugo-compiler by Randolph Kahle

About

A Docker container with the Hugo static web site generator local server configuration

Resources

Stars

Watchers

Forks

Packages

No packages published