FROM golang:1.22-alpine AS build

ARG HUGO_VERSION
ARG CGO=1

ENV CGO_ENABLED=${CGO}
ENV GOOS=linux
ENV GO111MODULE=on

RUN apk update && \
    apk add --no-cache gcc musl-dev g++ git
RUN go install -tags extended github.com/gohugoio/hugo@${HUGO_VERSION}