Convert to multi-stage Dockerfile.
- Remove architecture-specific Dockerfile and Makefile target. - Convert Dockerfile to a multi-stage build, keeping only what is needed to run.
This commit is contained in:
+22
-9
@@ -4,29 +4,42 @@
|
||||
# change is that the Hugo version is now an overridable argument rather than a fixed
|
||||
# environment variable.
|
||||
|
||||
FROM golang:1.15-alpine
|
||||
FROM golang:1.16-alpine
|
||||
|
||||
LABEL maintainer="Luc Perkins <lperkins@linuxfoundation.org>"
|
||||
|
||||
RUN apk add --no-cache \
|
||||
curl \
|
||||
git \
|
||||
openssh-client \
|
||||
rsync \
|
||||
gcc \
|
||||
g++ \
|
||||
musl-dev \
|
||||
build-base \
|
||||
libc6-compat \
|
||||
npm && \
|
||||
npm install -D autoprefixer postcss-cli
|
||||
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
|
||||
|
||||
FROM golang:1.16-alpine
|
||||
|
||||
RUN apk add --no-cache \
|
||||
git \
|
||||
openssh-client \
|
||||
rsync \
|
||||
npm && \
|
||||
npm install -D autoprefixer postcss-cli
|
||||
|
||||
RUN mkdir -p /usr/local/src && \
|
||||
cd /usr/local/src && \
|
||||
curl -L https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz | tar -xz && \
|
||||
mv hugo /usr/local/bin/hugo && \
|
||||
addgroup -Sg 1000 hugo && \
|
||||
adduser -Sg hugo -u 1000 -h /src hugo
|
||||
|
||||
COPY --from=0 /go/bin/hugo /usr/local/bin/hugo
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
USER hugo:hugo
|
||||
|
||||
Reference in New Issue
Block a user