mirror of
https://github.com/jakejarvis/hugo-docker.git
synced 2025-04-26 14:08:28 -04:00
add pandoc & docutils to final image
This commit is contained in:
parent
b807ac60eb
commit
912a1f4176
54
Dockerfile
54
Dockerfile
@ -3,10 +3,12 @@ ARG HUGO_VERSION=0.82.0
|
|||||||
# remove/comment the following line completely to compile vanilla Hugo:
|
# remove/comment the following line completely to compile vanilla Hugo:
|
||||||
ARG HUGO_BUILD_TAGS=extended
|
ARG HUGO_BUILD_TAGS=extended
|
||||||
|
|
||||||
|
# Hugo >= v0.81.0 requires Go 1.16+ to build
|
||||||
|
ARG GO_VERSION=1.16
|
||||||
|
|
||||||
# ---
|
# ---
|
||||||
|
|
||||||
# Hugo >= v0.81.0 requires Go 1.16+ to build
|
FROM golang:${GO_VERSION}-alpine AS build
|
||||||
FROM golang:1.16-alpine3.13 AS build
|
|
||||||
|
|
||||||
# renew global args from above
|
# renew global args from above
|
||||||
# https://docs.docker.com/engine/reference/builder/#scope
|
# https://docs.docker.com/engine/reference/builder/#scope
|
||||||
@ -36,11 +38,6 @@ RUN git clone \
|
|||||||
--depth 1 \
|
--depth 1 \
|
||||||
https://github.com/gohugoio/hugo.git ./
|
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
|
RUN mage -v hugo && mage install
|
||||||
|
|
||||||
# fix potential stack size problems on Alpine
|
# fix potential stack size problems on Alpine
|
||||||
@ -50,10 +47,11 @@ RUN go get github.com/yaegashi/muslstack && \
|
|||||||
|
|
||||||
# ---
|
# ---
|
||||||
|
|
||||||
FROM alpine:3.13
|
FROM alpine:latest
|
||||||
|
|
||||||
# renew global args from above
|
# renew global args from above & pin any dependency versions
|
||||||
ARG HUGO_VERSION
|
ARG HUGO_VERSION
|
||||||
|
ARG PANDOC_VERSION=2.13
|
||||||
|
|
||||||
LABEL version="${HUGO_VERSION}"
|
LABEL version="${HUGO_VERSION}"
|
||||||
LABEL repository="https://github.com/jakejarvis/hugo-docker"
|
LABEL repository="https://github.com/jakejarvis/hugo-docker"
|
||||||
@ -66,15 +64,22 @@ LABEL org.opencontainers.image.source="https://github.com/jakejarvis/hugo-docker
|
|||||||
# bring over patched binary from build stage
|
# bring over patched binary from build stage
|
||||||
COPY --from=build /go/bin/hugo /usr/local/bin/hugo
|
COPY --from=build /go/bin/hugo /usr/local/bin/hugo
|
||||||
|
|
||||||
# libc6-compat & libstdc++ are required for extended SASS libraries
|
# this step is intentionally a bit of a mess to minimize the number of layers in the final image
|
||||||
# ca-certificates are required to fetch outside resources (like Twitter oEmbeds)
|
RUN if [ "$(uname -m)" = "aarch64" ]; then \
|
||||||
RUN apk update && \
|
export ARCH="arm64"; \
|
||||||
|
else \
|
||||||
|
export ARCH="amd64"; \
|
||||||
|
fi && \
|
||||||
|
# alpine packages
|
||||||
|
# libc6-compat & libstdc++ are required for extended SASS libraries
|
||||||
|
# ca-certificates are required to fetch outside resources (like Twitter oEmbeds)
|
||||||
|
apk update && \
|
||||||
apk add --no-cache \
|
apk add --no-cache \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
|
tzdata \
|
||||||
git \
|
git \
|
||||||
nodejs \
|
nodejs \
|
||||||
npm \
|
npm \
|
||||||
yarn \
|
|
||||||
go \
|
go \
|
||||||
python3 \
|
python3 \
|
||||||
py3-pip \
|
py3-pip \
|
||||||
@ -82,24 +87,37 @@ RUN apk update && \
|
|||||||
libc6-compat \
|
libc6-compat \
|
||||||
libstdc++ && \
|
libstdc++ && \
|
||||||
update-ca-certificates && \
|
update-ca-certificates && \
|
||||||
|
# npm packages
|
||||||
npm install --global --production \
|
npm install --global --production \
|
||||||
|
yarn \
|
||||||
postcss \
|
postcss \
|
||||||
postcss-cli \
|
postcss-cli \
|
||||||
autoprefixer \
|
autoprefixer \
|
||||||
@babel/core \
|
@babel/core \
|
||||||
@babel/cli && \
|
@babel/cli && \
|
||||||
|
# ruby gems
|
||||||
gem install asciidoctor && \
|
gem install asciidoctor && \
|
||||||
pip3 install --upgrade Pygments==2.*
|
# python packages
|
||||||
|
python3 -m pip install --upgrade Pygments==2.* docutils && \
|
||||||
# verify everything's OK, exit otherwise
|
# manually fetch pandoc binary
|
||||||
RUN hugo env && \
|
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/local/bin/ && \
|
||||||
|
chmod +x /usr/local/bin/pandoc && \
|
||||||
|
rm -rf pandoc.tar.gz pandoc-${PANDOC_VERSION} && \
|
||||||
|
# make super duper sure that everything went OK, exit otherwise
|
||||||
|
hugo env && \
|
||||||
go version && \
|
go version && \
|
||||||
node --version && \
|
node --version && \
|
||||||
|
npm --version && \
|
||||||
|
yarn --version && \
|
||||||
postcss --version && \
|
postcss --version && \
|
||||||
autoprefixer --version && \
|
autoprefixer --version && \
|
||||||
babel --version && \
|
babel --version && \
|
||||||
pygmentize -V && \
|
pygmentize -V && \
|
||||||
asciidoctor --version
|
asciidoctor --version && \
|
||||||
|
pandoc --version && \
|
||||||
|
rst2html.py --version
|
||||||
|
|
||||||
# add site source as volume
|
# add site source as volume
|
||||||
VOLUME /src
|
VOLUME /src
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
[](https://github.com/jakejarvis/hugo-docker/actions/workflows/build.yml)
|
[](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
|
## Usage
|
||||||
|
|
||||||
@ -42,8 +42,10 @@ Just in case, the final Alpine Linux container includes a few small third-party
|
|||||||
- [Babel](https://babeljs.io/)
|
- [Babel](https://babeljs.io/)
|
||||||
- [Pygments](https://pygments.org/)
|
- [Pygments](https://pygments.org/)
|
||||||
- [Asciidoctor](https://asciidoctor.org/)
|
- [Asciidoctor](https://asciidoctor.org/)
|
||||||
|
- [Pandoc](https://pandoc.org/)
|
||||||
|
- [Docutils](https://docutils.sourceforge.io/) / [RST](https://docutils.sourceforge.io/rst.html)
|
||||||
|
|
||||||
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
|
## Licenses
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user