mirror of
https://github.com/gohugoio/hugo.git
synced 2024-12-29 02:02:43 +00:00
aa4ccb8a1e
When building the extended version of Hugo using the Dockerfile and `--build-arg HUGO_BUILD_TAGS=extended`, the obtained Docker container is broken, because the source is build under alpine 3.11 and the compiled binary is copied to an image based on alpine 3.10. This problem was most likely introduced due to an update of the golang base image. This commit changes the base image from alpine:3.10 to alpine:3.11, fixing extended version builds.
45 lines
1 KiB
Docker
Executable file
45 lines
1 KiB
Docker
Executable file
# GitHub: https://github.com/gohugoio
|
|
# Twitter: https://twitter.com/gohugoio
|
|
# Website: https://gohugo.io/
|
|
|
|
FROM golang:1.13-alpine AS build
|
|
|
|
# Optionally set HUGO_BUILD_TAGS to "extended" 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
|
|
|
|
WORKDIR /go/src/github.com/gohugoio/hugo
|
|
|
|
COPY . /go/src/github.com/gohugoio/hugo/
|
|
|
|
# gcc/g++ are required to build SASS libraries for extended version
|
|
RUN apk update && \
|
|
apk add --no-cache gcc g++ musl-dev && \
|
|
go get github.com/magefile/mage
|
|
|
|
RUN mage hugo && mage install
|
|
|
|
# ---
|
|
|
|
FROM alpine:3.11
|
|
|
|
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 && \
|
|
apk add --no-cache ca-certificates libc6-compat libstdc++
|
|
|
|
VOLUME /site
|
|
WORKDIR /site
|
|
|
|
# Expose port for live server
|
|
EXPOSE 1313
|
|
|
|
ENTRYPOINT ["hugo"]
|
|
CMD ["--help"]
|