From ef25dd39bbca22a17003c65e7d573e8db162835c Mon Sep 17 00:00:00 2001 From: Maik Ellerbrock Date: Mon, 11 Dec 2017 03:03:55 +0100 Subject: [PATCH] build(docker-build): optimize the docker build process Signed-off-by: Maik Ellerbrock --- Dockerfile | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 87683eb60ab..08502ab39db 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,16 +9,23 @@ FROM golang:1.10-rc-alpine3.7 AS build ENV CGO_ENABLED=0 ENV GOOS=linux +WORKDIR /go/src/github.com/gohugoio/hugo + RUN \ apk add --no-cache \ 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' + go get github.com/golang/dep/cmd/dep + +COPY Gopkg.lock Gopkg.toml /go/src/github.com/gohugoio/hugo/ + +RUN dep ensure -vendor-only + +COPY . /go/src/github.com/gohugoio/hugo/ + +RUN go install -ldflags '-s -w' + +COPY . /go/src/github.com/gohugoio/hugo/ # ---