Files
gohugoio-hugo/Dockerfile
T

46 lines
1.1 KiB
Docker
Raw Normal View History

2018-03-18 16:54:49 -04:00
# GitHub: https://github.com/gohugoio
# Twitter: https://twitter.com/gohugoio
# Website: https://gohugo.io/
2016-01-04 17:27:21 +10:00
2023-08-23 18:06:52 +02:00
FROM golang:1.21-alpine AS build
2018-03-18 16:54:49 -04:00
# Optionally set HUGO_BUILD_TAGS to "extended" or "nodeploy" when building like so:
# docker build --build-arg HUGO_BUILD_TAGS=extended .
ARG HUGO_BUILD_TAGS
ARG CGO=1
ENV CGO_ENABLED=${CGO}
ENV GOOS=linux
ENV GO111MODULE=on
2017-09-07 15:17:44 +02:00
2017-09-07 15:08:56 +02:00
WORKDIR /go/src/github.com/gohugoio/hugo
2018-03-18 16:54:49 -04:00
COPY . /go/src/github.com/gohugoio/hugo/
# gcc/g++ are required to build SASS libraries for extended version
RUN apk update && \
2021-12-12 21:45:08 +08:00
apk add --no-cache gcc g++ musl-dev git && \
2022-03-21 10:25:12 -06:00
go install github.com/magefile/mage
RUN mage hugo && mage install
2018-03-18 16:54:49 -04:00
# ---
2016-01-04 17:27:21 +10:00
2023-08-23 18:06:52 +02:00
FROM alpine:3.18
COPY --from=build /go/bin/hugo /usr/bin/hugo
# libc6-compat & libstdc++ are required for extended SASS libraries
# ca-certificates are required to fetch outside resources (like Twitter oEmbeds)
RUN apk update && \
2020-02-14 07:49:20 -08:00
apk add --no-cache ca-certificates libc6-compat libstdc++ git
VOLUME /site
WORKDIR /site
# Expose port for live server
EXPOSE 1313
ENTRYPOINT ["hugo"]
CMD ["--help"]