From 76e065dd0f1ebe5d50b71b8b358943b968c0a1b0 Mon Sep 17 00:00:00 2001 From: Maik Ellerbrock Date: Sun, 10 Dec 2017 02:01:52 +0100 Subject: [PATCH] fix(dockerfile): fix broken docker build and optimize dockerfile --- Dockerfile | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 889584b616b..52b17001a0b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,23 +1,35 @@ -FROM golang:1.9.0-alpine3.6 AS build +# GitHub: https://github.com/gohugoio/ +# Docker: https://hub.docker.com/r/gohugoio/ +# Twitter: https://twitter.com/gohugoio -RUN apk add --no-cache --virtual git musl-dev -RUN go get github.com/golang/dep/cmd/dep +FROM golang:1.10-rc-alpine3.7 AS build -WORKDIR /go/src/github.com/gohugoio/hugo -RUN dep ensure -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 + git \ + musl-dev && \ + go get github.com/golang/dep/cmd/dep && \ + go get github.com/kardianos/govendor && \ + govendor get github.com/gohugoio/hugo && \ + cd /go/src/github.com/gohugoio/hugo && \ + dep ensure && \ + go install -ldflags '-s -w' + +# --- + +FROM alpine:3.7 + COPY --from=build /go/bin/hugo /bin/hugo + +RUN \ + adduser -h /site -s /sbin/nologin -u 1000 -D hugo && \ + apk add --no-cache dumb-init + USER hugo WORKDIR /site VOLUME /site EXPOSE 1313 -ENTRYPOINT ["/usr/bin/dumb-init", "--", "hugo"] +ENTRYPOINT [ "/usr/bin/dumb-init", "--", "hugo" ] CMD [ "--help" ] +