2018-06-21 17:13:29 +00:00
|
|
|
# Credit to Julien Guyomard (https://github.com/jguyomard). This Dockerfile
|
|
|
|
# is essentially based on his Dockerfile at
|
|
|
|
# https://github.com/jguyomard/docker-hugo/blob/master/Dockerfile. The only significant
|
|
|
|
# change is that the Hugo version is now an overridable argument rather than a fixed
|
|
|
|
# environment variable.
|
|
|
|
|
2022-04-21 01:53:28 +00:00
|
|
|
FROM golang:1.18-alpine
|
2018-06-21 17:13:29 +00:00
|
|
|
|
2019-12-18 15:03:58 +00:00
|
|
|
LABEL maintainer="Luc Perkins <lperkins@linuxfoundation.org>"
|
2018-06-21 17:13:29 +00:00
|
|
|
|
|
|
|
RUN apk add --no-cache \
|
|
|
|
curl \
|
2022-03-09 13:05:56 +00:00
|
|
|
gcc \
|
|
|
|
g++ \
|
|
|
|
musl-dev \
|
|
|
|
build-base \
|
|
|
|
libc6-compat
|
|
|
|
|
|
|
|
ARG HUGO_VERSION
|
|
|
|
|
|
|
|
RUN mkdir $HOME/src && \
|
|
|
|
cd $HOME/src && \
|
|
|
|
curl -L https://github.com/gohugoio/hugo/archive/refs/tags/v${HUGO_VERSION}.tar.gz | tar -xz && \
|
|
|
|
cd "hugo-${HUGO_VERSION}" && \
|
|
|
|
go install --tags extended
|
|
|
|
|
2022-04-21 01:53:28 +00:00
|
|
|
FROM golang:1.18-alpine
|
2022-03-09 13:05:56 +00:00
|
|
|
|
|
|
|
RUN apk add --no-cache \
|
2022-04-14 16:10:39 +00:00
|
|
|
runuser \
|
2018-06-21 17:13:29 +00:00
|
|
|
git \
|
|
|
|
openssh-client \
|
2018-09-20 11:46:08 +00:00
|
|
|
rsync \
|
2020-07-01 21:12:21 +00:00
|
|
|
npm && \
|
2020-11-01 02:01:10 +00:00
|
|
|
npm install -D autoprefixer postcss-cli
|
2018-06-21 17:13:29 +00:00
|
|
|
|
2022-04-14 16:10:39 +00:00
|
|
|
RUN mkdir -p /var/hugo && \
|
2018-06-21 17:13:29 +00:00
|
|
|
addgroup -Sg 1000 hugo && \
|
2022-04-14 16:10:39 +00:00
|
|
|
adduser -Sg hugo -u 1000 -h /var/hugo hugo && \
|
|
|
|
chown -R hugo: /var/hugo && \
|
|
|
|
runuser -u hugo -- git config --global --add safe.directory /src
|
2018-06-21 17:13:29 +00:00
|
|
|
|
2022-03-09 13:05:56 +00:00
|
|
|
COPY --from=0 /go/bin/hugo /usr/local/bin/hugo
|
|
|
|
|
2018-06-21 17:13:29 +00:00
|
|
|
WORKDIR /src
|
|
|
|
|
2020-10-03 03:10:33 +00:00
|
|
|
USER hugo:hugo
|
|
|
|
|
2018-06-21 17:13:29 +00:00
|
|
|
EXPOSE 1313
|