mirror of https://github.com/perkeep/perkeep.git
docker: improving caching of go modules
download go modules as its own image layer, rather than as part of compiling perkeep. This reduces image build time by approximately 40% in cases where modules are unchanged (109 to 67 seconds in my testing).
This commit is contained in:
parent
cd0b392d11
commit
1302c5aaf1
|
@ -13,6 +13,11 @@ MAINTAINER Perkeep Authors <perkeep@googlegroups.com>
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND noninteractive
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
|
|
||||||
|
WORKDIR /go/src/perkeep.org
|
||||||
|
|
||||||
|
COPY go.mod go.sum ./
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
# Add each directory separately, so our context doesn't include the
|
# Add each directory separately, so our context doesn't include the
|
||||||
# Dockerfile itself, to permit quicker iteration with docker's
|
# Dockerfile itself, to permit quicker iteration with docker's
|
||||||
# caching.
|
# caching.
|
||||||
|
@ -29,10 +34,6 @@ ADD server /go/src/perkeep.org/server
|
||||||
ADD website /go/src/perkeep.org/website
|
ADD website /go/src/perkeep.org/website
|
||||||
ADD make.go /go/src/perkeep.org/make.go
|
ADD make.go /go/src/perkeep.org/make.go
|
||||||
ADD VERSION /go/src/perkeep.org/VERSION
|
ADD VERSION /go/src/perkeep.org/VERSION
|
||||||
ADD go.mod /go/src/perkeep.org/go.mod
|
|
||||||
ADD go.sum /go/src/perkeep.org/go.sum
|
|
||||||
|
|
||||||
WORKDIR /go/src/perkeep.org
|
|
||||||
|
|
||||||
RUN go run make.go -v
|
RUN go run make.go -v
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue