Skip to content

Commit 31e05f9

Browse files
eval-execjagdeep sidhu
authored andcommitted
docker: speed up docker image build (ethereum#24796)
This PR improves the docker build speed for repeated builds where go.mod and go.sum do no change, by placing the downloaded dependencies in a lower layer
1 parent febadf9 commit 31e05f9

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ FROM golang:1.18-alpine as builder
88

99
RUN apk add --no-cache gcc musl-dev linux-headers git
1010

11+
# Get dependencies - will also be cached if we won't change go.mod/go.sum
12+
COPY go.mod /go-ethereum/
13+
COPY go.sum /go-ethereum/
14+
RUN cd /go-ethereum && go mod download
15+
1116
ADD . /go-ethereum
1217
RUN cd /go-ethereum && go run build/ci.go install ./cmd/geth
1318

Dockerfile.alltools

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ FROM golang:1.18-alpine as builder
88

99
RUN apk add --no-cache gcc musl-dev linux-headers git
1010

11+
# Get dependencies - will also be cached if we won't change go.mod/go.sum
12+
COPY go.mod /go-ethereum/
13+
COPY go.sum /go-ethereum/
14+
RUN cd /go-ethereum && go mod download
15+
1116
ADD . /go-ethereum
1217
RUN cd /go-ethereum && go run build/ci.go install
1318

0 commit comments

Comments
 (0)