<commit_before># GitHub:       https://github.com/gohugoio
# Twitter:      https://twitter.com/gohugoio
# Website:      https://gohugo.io/

FROM golang:1.11-stretch AS build


WORKDIR /go/src/github.com/gohugoio/hugo
RUN apt-get install \
    git gcc g++ binutils
COPY . /go/src/github.com/gohugoio/hugo/
ENV GO111MODULE=on
RUN go get -d .

ARG CGO=0
ENV CGO_ENABLED=${CGO}
ENV GOOS=linux

# default non-existent build tag so -tags always has an arg
ARG BUILD_TAGS="99notag"
RUN go install -ldflags '-w -extldflags "-static"' -tags ${BUILD_TAGS}

# ---

FROM alpine:3.9
RUN apk add --no-cache ca-certificates
COPY --from=build /go/bin/hugo /hugo
ARG  WORKDIR="/site"
WORKDIR ${WORKDIR}
VOLUME  ${WORKDIR}
EXPOSE  1313
ENTRYPOINT [ "/hugo" ]
CMD [ "--help" ]<commit_msg>Dockerfile: Switch to mage builds, various optimizations<commit_after># 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.10

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"]
{'fraction_non_alphanumeric': 0.1248688352570829, 'fraction_numerical': 0.01626442812172088, 'mean_word_length': 3.4870588235294115, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6973823', 'n_tokens_mistral': 759, 'n_tokens_neox': 719, 'n_words': 197}