mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
d9697e275e
To maximize the usage of cache, split the govendor get in steps: - govendor fetch to get the pinned versions of dependencies - go install to actually build the binary Doing so allows not to re-download the whole dependencies when changing lines in hugo repository The current Dockerfile generates an image of 16.6MB Signed-off-by: Thibault Jamet <tjamet@users.noreply.github.com>
24 lines
610 B
Docker
24 lines
610 B
Docker
FROM golang:1.9.0-alpine3.6 AS build
|
|
|
|
RUN apk add --no-cache --virtual git musl-dev
|
|
RUN go get github.com/kardianos/govendor
|
|
|
|
ADD vendor/vendor.json /go/src/github.com/gohugoio/hugo/vendor/vendor.json
|
|
WORKDIR /go/src/github.com/gohugoio/hugo
|
|
RUN govendor sync
|
|
ADD . /go/src/github.com/gohugoio/hugo/
|
|
RUN go install -ldflags '-s -w'
|
|
|
|
FROM alpine:3.6
|
|
RUN \
|
|
adduser -h /site -s /sbin/nologin -u 1000 -D hugo && \
|
|
apk add --no-cache \
|
|
dumb-init
|
|
COPY --from=build /go/bin/hugo /bin/hugo
|
|
USER hugo
|
|
WORKDIR /site
|
|
VOLUME /site
|
|
EXPOSE 1313
|
|
|
|
ENTRYPOINT ["/usr/bin/dumb-init", "--", "hugo"]
|
|
CMD [ "--help" ]
|