Skip to content

Latest commit

 

History

History

hugo

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

hugo

distroless/cc-based dockerization of hugo-extended -- the static site generator

I use it as a builder in multi-stage image builds, I also run it interactively during development.

The source code for this image is hosted on GitHub in the backplane/conex repo.

Usage

Interactive

This shell function demonstrates using this container image in place of having the actual hugo binary.

hugo() {
  insert=""
  if [ "$1" = "server" ] || [ "$1" = "serve" ]; then
    shift;
    insert="server --bind 0.0.0.0 --port 1313"
  fi

  # shellcheck disable=SC2086
  docker run \
    --rm \
    --interactive \
    --tty \
    --volume "$(pwd):/work" \
    --publish "1313:1313" \
    backplane/hugo \
    hugo \
      $insert \
      "$@"
}

You just add the above function to your shell rc file then use hugo normally:

$ hugo

or

$ hugo serve -D

As Build Stage

FROM backplane/hugo as builder

COPY . .
RUN hugo

FROM nginx:1-alpine as server
COPY --from=builder /work/public/ /usr/share/nginx/html/