1
mirror of https://github.com/jakejarvis/hugo-docker.git synced 2025-07-02 01:06:41 -04:00

Compare commits

...

38 Commits

Author SHA1 Message Date
92748c6c0f Hugo v0.93.3 2022-03-08 10:26:46 -05:00
18a14635c0 Hugo v0.93.2 2022-03-04 09:16:30 -05:00
3cb403f6fa Hugo v0.93.1 2022-03-02 10:38:03 -05:00
70c9d418ec Hugo v0.93.0 2022-02-28 13:18:35 -05:00
4ec3e8be98 Hugo v0.92.2 2022-02-11 20:23:55 -05:00
f1513cf6c7 Hugo v0.92.1 2022-01-27 11:39:10 -05:00
e608453299 Hugo v0.92.0 2022-01-13 13:58:50 -05:00
7a43febe15 Hugo v0.91.2 2021-12-23 14:34:14 -05:00
4898a96b66 Hugo v0.91.1 2021-12-23 13:17:33 -05:00
73e0bf7815 Hugo v0.91.0 2021-12-17 08:38:39 -05:00
d6ca9055b4 Hugo v0.90.1 2021-12-10 13:03:12 -05:00
bca0721d67 Hugo v0.90.0 2021-12-08 10:50:19 -05:00
33bd893ed3 Hugo v0.89.4 2021-11-17 08:57:41 -05:00
d9338044c5 Hugo v0.89.3 2021-11-15 09:27:24 -05:00
cb26219a40 Hugo v0.89.2 2021-11-08 11:05:02 -05:00
f6580ec25c Hugo v0.89.1 2021-11-05 12:28:16 -04:00
6bc21e062a Hugo v0.89.0 2021-11-02 08:56:03 -04:00
04930ae9ae Hugo v0.88.1 2021-09-04 08:09:11 -04:00
eb82474eb8 Hugo v0.88.0, Go v1.17 2021-09-02 08:09:16 -04:00
90b15c893d Hugo v0.87.0 2021-08-03 13:33:51 -04:00
b31b18ac2d bump alpine, pandoc, and sass embedded versions 2021-07-30 10:23:11 -04:00
4df70ef38c Hugo v0.86.1 2021-07-30 08:33:13 -04:00
f75b85512b Hugo v0.86.0 2021-07-21 08:21:54 -04:00
f97154879d Hugo v0.85.0 2021-07-05 08:05:59 -04:00
4f1d3a9c48 Hugo v0.84.4 2021-07-01 09:33:05 -04:00
22ba6e27d0 Hugo v0.84.3 2021-06-29 08:44:34 -04:00
3123853163 Hugo v0.84.2 2021-06-28 08:39:27 -04:00
5d7840092e Hugo v0.84.1 2021-06-24 21:03:20 -04:00
7d20947610 Hugo v0.84.0 2021-06-18 17:57:55 -04:00
a6b5427dca bump pandoc to v2.14
https://github.com/jgm/pandoc/releases/tag/2.14
2021-05-29 10:26:16 -04:00
941079893a Hugo v0.83.1 2021-05-02 11:30:07 -04:00
8a2fe24434 Update README.md
[skip ci]
2021-05-01 10:09:26 -04:00
bdf6d208b4 Hugo v0.83.0 2021-05-01 09:09:40 -04:00
de4ef2242f install dart SASS embedded (on amd64 image only) 2021-05-01 09:09:23 -04:00
a7e4ccee25 Hugo v0.82.1 2021-04-20 09:36:36 -04:00
77fc7a219c clear temp directories and caches in final image 2021-04-03 09:38:06 -04:00
b9d9a45c6a Update build.yml
[skip ci]
2021-03-31 10:31:53 -04:00
912a1f4176 add pandoc & docutils to final image 2021-03-30 17:51:44 -04:00
3 changed files with 65 additions and 26 deletions

View File

@ -6,10 +6,12 @@ on:
- master
tags:
- 'v*'
workflow_dispatch:
jobs:
docker:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- name: Checkout
uses: actions/checkout@v2

View File

@ -1,12 +1,15 @@
# the following version can be overridden at image build time with --build-arg
ARG HUGO_VERSION=0.82.0
ARG HUGO_VERSION=0.93.3
# remove/comment the following line completely to compile vanilla Hugo:
ARG HUGO_BUILD_TAGS=extended
# Hugo >= v0.81.0 requires Go 1.16+ to build
ARG GO_VERSION=1.17
ARG ALPINE_VERSION=3.15
# ---
# Hugo >= v0.81.0 requires Go 1.16+ to build
FROM golang:1.16-alpine3.13 AS build
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS build
# renew global args from above
# https://docs.docker.com/engine/reference/builder/#scope
@ -21,8 +24,7 @@ ENV GO111MODULE=on
WORKDIR /go/src/github.com/gohugoio/hugo
# gcc/g++ are required to build SASS libraries for extended version
RUN apk update && \
apk add --no-cache \
RUN apk add --update --no-cache \
gcc \
g++ \
musl-dev \
@ -36,11 +38,6 @@ RUN git clone \
--depth 1 \
https://github.com/gohugoio/hugo.git ./
# download source from GitHub release (old method):
# RUN wget https://github.com/gohugoio/hugo/archive/v${HUGO_VERSION}.tar.gz && \
# tar xf v${HUGO_VERSION}.tar.gz --strip-components=1 && \
# rm v${HUGO_VERSION}.tar.gz
RUN mage -v hugo && mage install
# fix potential stack size problems on Alpine
@ -50,10 +47,14 @@ RUN go get github.com/yaegashi/muslstack && \
# ---
FROM alpine:3.13
FROM alpine:${ALPINE_VERSION}
# renew global args from above
# renew global args from above & pin any dependency versions
ARG HUGO_VERSION
# https://github.com/jgm/pandoc/releases
ARG PANDOC_VERSION=2.17.1.1
# https://github.com/sass/dart-sass-embedded/releases
ARG DART_SASS_VERSION=1.49.9
LABEL version="${HUGO_VERSION}"
LABEL repository="https://github.com/jakejarvis/hugo-docker"
@ -64,17 +65,26 @@ LABEL maintainer="Jake Jarvis <jake@jarv.is>"
LABEL org.opencontainers.image.source="https://github.com/jakejarvis/hugo-docker"
# bring over patched binary from build stage
COPY --from=build /go/bin/hugo /usr/local/bin/hugo
COPY --from=build /go/bin/hugo /usr/bin/hugo
# libc6-compat & libstdc++ are required for extended SASS libraries
# ca-certificates are required to fetch outside resources (like Twitter oEmbeds)
RUN apk update && \
apk add --no-cache \
# this step is intentionally a bit of a mess to minimize the number of layers in the final image
RUN set -euo pipefail && \
if [ "$(uname -m)" = "x86_64" ]; then \
ARCH="amd64"; \
elif [ "$(uname -m)" = "aarch64" ]; then \
ARCH="arm64"; \
else \
echo "Unknown build architecture, quitting." && exit 2; \
fi && \
# alpine packages
# libc6-compat & libstdc++ are required for extended SASS libraries
# ca-certificates are required to fetch outside resources (like Twitter oEmbeds)
apk add --update --no-cache \
ca-certificates \
tzdata \
git \
nodejs \
npm \
yarn \
go \
python3 \
py3-pip \
@ -82,24 +92,48 @@ RUN apk update && \
libc6-compat \
libstdc++ && \
update-ca-certificates && \
# npm packages
npm install --global --production \
yarn \
postcss \
postcss-cli \
autoprefixer \
@babel/core \
@babel/cli && \
npm cache clean --force && \
# ruby gems
gem install asciidoctor && \
pip3 install --upgrade Pygments==2.*
# verify everything's OK, exit otherwise
RUN hugo env && \
# python packages
python3 -m pip install --no-cache-dir --upgrade Pygments==2.* docutils && \
# manually fetch pandoc binary
wget -O pandoc.tar.gz https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pandoc-${PANDOC_VERSION}-linux-${ARCH}.tar.gz && \
tar xf pandoc.tar.gz && \
mv ./pandoc-${PANDOC_VERSION}/bin/pandoc /usr/bin/ && \
chmod +x /usr/bin/pandoc && \
rm -rf pandoc.tar.gz pandoc-${PANDOC_VERSION} && \
# manually fetch Dart SASS binary (on x64 only)
if [ "$ARCH" = "amd64" ]; then \
wget -O sass-embedded.tar.gz https://github.com/sass/dart-sass-embedded/releases/download/${DART_SASS_VERSION}/sass_embedded-${DART_SASS_VERSION}-linux-x64.tar.gz && \
tar xf sass-embedded.tar.gz && \
mv ./sass_embedded/dart-sass-embedded /usr/bin/ && \
chmod +x /usr/bin/dart-sass-embedded && \
rm -rf sass-embedded.tar.gz sass_embedded; \
fi && \
# clean up some junk
rm -rf /tmp/* /var/tmp/* /var/cache/apk/* && \
# make super duper sure that everything went OK, exit otherwise
hugo env && \
go version && \
node --version && \
npm --version && \
yarn --version && \
postcss --version && \
autoprefixer --version && \
babel --version && \
pygmentize -V && \
asciidoctor --version
asciidoctor --version && \
pandoc --version && \
rst2html.py --version
# add site source as volume
VOLUME /src

View File

@ -1,8 +1,8 @@
# ✏️ [Hugo Extended](https://github.com/gohugoio/hugo) via Docker
# ✏️ [Hugo Extended](https://github.com/gohugoio/hugo) via Docker
[![Build](https://github.com/jakejarvis/hugo-docker/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/jakejarvis/hugo-docker/actions/workflows/build.yml)
A base image to ease local development of Hugo sites, including [Hugo Extended](https://gohugo.io/troubleshooting/faq/#i-get-tocss-this-feature-is-not-available-in-your-current-hugo-version) (with SASS/SCSS support) and optional third-party tools ([listed below](#third-party-software)). Now includes native support for both AMD64 and ARM64 platforms!
A base image to ease local development of Hugo sites, including [Hugo Extended](https://gohugo.io/troubleshooting/faq/#i-get-tocss-this-feature-is-not-available-in-your-current-hugo-version) (with SASS/SCSS support) and optional third-party tools ([listed below](#third-party-software)). Now with [multi-architecture images](https://docs.docker.com/docker-for-mac/multi-arch/) for native AMD64 and ARM64 support!
## Usage
@ -42,8 +42,11 @@ Just in case, the final Alpine Linux container includes a few small third-party
- [Babel](https://babeljs.io/)
- [Pygments](https://pygments.org/)
- [Asciidoctor](https://asciidoctor.org/)
- [Pandoc](https://pandoc.org/)
- [Docutils](https://docutils.sourceforge.io/) / [RST](https://docutils.sourceforge.io/rst.html)
- [Embedded Dart Sass](https://github.com/sass/dart-sass-embedded) (amd64 only)
Node (with NPM and Yarn) and Go (for [Hugo Modules](https://gohugo.io/hugo-modules/) support) are also pre-installed.
Node (with NPM and Yarn), Go (for [Hugo Modules](https://gohugo.io/hugo-modules/) support), and Python are also pre-installed.
## Licenses