build(deps): use prebuilt hugo binary, add gcompat

Fetching the prebuilt hugo binary is faster than `go install`.
Also switching to the extended version.

Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
David Karlsson 2024-01-31 22:23:30 +01:00
parent 6da0b60ccc
commit a1102d1a35
1 changed files with 5 additions and 4 deletions

View File

@ -5,7 +5,7 @@ ARG HTMLTEST_VERSION=0.17.0
FROM golang:${GO_VERSION}-alpine as base
WORKDIR /src
RUN apk --update add nodejs npm git
RUN apk --update add nodejs npm git gcompat
FROM base as node
COPY package*.json .
@ -14,11 +14,12 @@ RUN npm install && npm cache clean --force
FROM base as hugo
ARG HUGO_VERSION=0.122.0
ARG TARGETARCH
WORKDIR /bin
RUN go install github.com/gohugoio/hugo@v${HUGO_VERSION}
WORKDIR /tmp/hugo
RUN wget -O "hugo.tar.gz" "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-${TARGETARCH}.tar.gz"
RUN tar -xf "hugo.tar.gz" hugo
FROM base as build-base
COPY --from=hugo $GOPATH/bin/hugo /bin/hugo
COPY --from=hugo /tmp/hugo/hugo /bin/hugo
COPY --from=node /src/node_modules /src/node_modules
COPY . .