1
mirror of https://github.com/jakejarvis/hugo-docker.git synced 2026-06-13 01:35:27 -04:00
Greg Baker e91bc2ed98 This commit fixes a failure scenario caused when the UID of the user within the hugo-extended container does not match the UID or GID of the respective user and group ownership assigned to the files and directories in the volume mounted to /src.
The failure occurs when a git operation triggers recently added safe directory checks to alert the user when there is a UID or GID mismatch.  Because the ENTRYPOINT of the hugo-extended container is a call to `hugo`, there is no ability for the end user of the container to tell git to trust the /src directory before hugo is started.

It is possible to override the UID and GID when using the container, but this causes permission errors and does not seem like a user-friendly path forward.

After this change, the hugo-extended container will contain a global git configuration to trust the /src directory.  This may have security implications that have not been considered, but since only the project directory is mounted to /src, this approach seems to respect the intent of git safe directory checks.
2023-03-02 10:36:36 -05:00
2023-01-17 10:44:09 -05:00
2019-09-12 12:37:04 -04:00
2021-05-01 10:09:26 -04:00

✏️ Hugo Extended via Docker

Build

A base image to ease local development of Hugo sites, including Hugo Extended (with SASS/SCSS support) and optional third-party tools (listed below). Now with multi-architecture images for native AMD64 and ARM64 support!

Usage

Command line

This will start a live server at http://localhost:1313/ from the Hugo site in your current directory:

docker run -v $(pwd):/src -p 1313:1313 jakejarvis/hugo-extended:latest server --buildDrafts --buildFuture --bind 0.0.0.0

docker-compose.yml

version: '3'

services:
  hugo:
    image: jakejarvis/hugo-extended:latest
    ports:
      - 1313:1313
    volumes:
      - ./:/src
    command: server --buildDrafts --buildFuture --bind 0.0.0.0

Notes

When using Docker to run a live server (i.e. hugo server), you must pass --bind 0.0.0.0 as an argument to fix some networking quirks between Hugo, the container, and the host.

Third-party software

Just in case, the final Alpine Linux container includes a few small third-party tools that are required by certain optional Hugo features:

Node (with NPM and Yarn), Go (for Hugo Modules support), and Python are also pre-installed.

Licenses

This project is distributed under the MIT License. Hugo is distributed under the Apache License 2.0.

S
Description
✏️ Dockerized Hugo Extended with Asciidoctor, Pygments, Babel, PostCSS, and Autoprefixer baked-in
Readme MIT 1.3 MiB
Languages
Dockerfile 100%