Dockerfile (1094B)
1 # GitHub: https://github.com/gohugoio 2 # Twitter: https://twitter.com/gohugoio 3 # Website: https://gohugo.io/ 4 5 FROM golang:1.18-alpine AS build 6 7 # Optionally set HUGO_BUILD_TAGS to "extended" or "nodeploy" when building like so: 8 # docker build --build-arg HUGO_BUILD_TAGS=extended . 9 ARG HUGO_BUILD_TAGS 10 11 ARG CGO=1 12 ENV CGO_ENABLED=${CGO} 13 ENV GOOS=linux 14 ENV GO111MODULE=on 15 16 WORKDIR /go/src/github.com/gohugoio/hugo 17 18 COPY . /go/src/github.com/gohugoio/hugo/ 19 20 # gcc/g++ are required to build SASS libraries for extended version 21 RUN apk update && \ 22 apk add --no-cache gcc g++ musl-dev git && \ 23 go install github.com/magefile/mage 24 25 RUN mage hugo && mage install 26 27 # --- 28 29 FROM alpine:3.12 30 31 COPY --from=build /go/bin/hugo /usr/bin/hugo 32 33 # libc6-compat & libstdc++ are required for extended SASS libraries 34 # ca-certificates are required to fetch outside resources (like Twitter oEmbeds) 35 RUN apk update && \ 36 apk add --no-cache ca-certificates libc6-compat libstdc++ git 37 38 VOLUME /site 39 WORKDIR /site 40 41 # Expose port for live server 42 EXPOSE 1313 43 44 ENTRYPOINT ["hugo"] 45 CMD ["--help"]