Skip to content

Commit

Permalink
Use pre-built jakejarvis/hugo-docker image to speed up action
Browse files Browse the repository at this point in the history
  • Loading branch information
jakejarvis committed Dec 19, 2020
1 parent 2ef04db commit 0aeee38
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 60 deletions.
61 changes: 2 additions & 59 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,61 +1,4 @@
# Hugo doesn't require Go to run, *except* if you're using Hugo Modules. It's
# much easier to install Node on the Go base image than vice-versa.
FROM golang:1.15-alpine

# the following version can be overridden at image build time with --build-arg
ARG HUGO_VERSION=0.79.0
# remove/comment the following line completely to build with vanilla Hugo:
ARG HUGO_EXTENDED=1

LABEL "com.github.actions.name"="Hugo Build"
LABEL "com.github.actions.description"="Hugo as an action, with extended support and legacy versions"
LABEL "com.github.actions.icon"="edit"
LABEL "com.github.actions.color"="gray-dark"

LABEL version="${HUGO_VERSION}${HUGO_EXTENDED:+-extended}"
LABEL repository="https://github.com/jakejarvis/hugo-build-action"
LABEL homepage="https://jarv.is/"
LABEL maintainer="Jake Jarvis <jake@jarv.is>"

# only install libc6-compat & libstdc++ if we're building extended Hugo
# https://gitlab.com/yaegashi/hugo/commit/22f0d5cbd6114210ba7835468facbdee60609aa2
RUN apk update && \
apk add --no-cache \
ca-certificates \
git \
nodejs \
npm \
yarn \
python3 \
py3-pip \
ruby \
${HUGO_EXTENDED:+libc6-compat libstdc++} && \
update-ca-certificates

# download Hugo and miscellaneous optional dependencies
RUN npm install --global postcss postcss-cli autoprefixer @babel/core @babel/cli && \
pip3 install --upgrade Pygments==2.* && \
gem install asciidoctor && \
wget https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_EXTENDED:+extended_}${HUGO_VERSION}_Linux-64bit.tar.gz && \
wget https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_checksums.txt && \
grep hugo_${HUGO_EXTENDED:+extended_}${HUGO_VERSION}_Linux-64bit.tar.gz hugo_${HUGO_VERSION}_checksums.txt | sha256sum -c && \
tar xf hugo_${HUGO_EXTENDED:+extended_}${HUGO_VERSION}_Linux-64bit.tar.gz && \
mv ./hugo /usr/local/bin/ && \
chmod +x /usr/local/bin/hugo && \
rm -rf hugo_* LICENSE README.md

# fix potential stack size problems on Alpine
# https://github.com/microsoft/vscode-dev-containers/blob/fb63f7e016877e13535d4116b458d8f28012e87f/containers/hugo/.devcontainer/Dockerfile#L19
RUN go get github.com/yaegashi/muslstack && \
muslstack -s 0x800000 /usr/local/bin/hugo

# verify everything's OK, fail otherwise
RUN hugo version && \
hugo env && \
postcss --version && \
autoprefixer --version && \
babel --version && \
pygmentize -V && \
asciidoctor --version
# https://github.com/jakejarvis/hugo-docker
FROM ghcr.io/jakejarvis/hugo-extended:0.79.0

ENTRYPOINT ["hugo"]
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: "Hugo as an action, with extended support and legacy versions"
author: jakejarvis
runs:
using: docker
image: Dockerfile
image: docker://ghcr.io/jakejarvis/hugo-extended:0.79.0
branding:
icon: edit
color: gray-dark

0 comments on commit 0aeee38

Please sign in to comment.