diff options
Diffstat (limited to 'Dockerfile')
-rw-r--r-- | Dockerfile | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/Dockerfile b/Dockerfile index f8ec73a86..ca165a986 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,30 +1,18 @@ -FROM alpine:3.6 +FROM golang:1.9.0-alpine3.6 AS build -ENV GOPATH /go -ENV PATH $GOPATH/bin:$PATH +RUN apk add --no-cache --virtual git musl-dev +RUN go get github.com/kardianos/govendor +RUN govendor get github.com/gohugoio/hugo +WORKDIR /go/src/github.com/gohugoio/hugo +RUN rm -f $GOPATH/bin/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 && \ - apk add --no-cache --virtual .build-deps \ - gcc \ - musl-dev \ - go \ - git && \ - mkdir -p \ - ${GOPATH}/bin \ - ${GOPATH}/pkg \ - ${GOPATH}/src && \ - go get github.com/kardianos/govendor && \ - govendor get github.com/gohugoio/hugo && \ - cd $GOPATH/src/github.com/gohugoio/hugo && \ - rm -f $GOPATH/bin/hugo && \ - go install -ldflags '-s -w' && \ - cd $GOPATH && \ - rm -rf pkg src .cache bin/govendor && \ - apk del .build-deps - + dumb-init +COPY --from=build /go/bin/hugo /bin/hugo USER hugo WORKDIR /site VOLUME /site |