Skip to content

Commit 58f1e8b

Browse files
eval-execunclezoro
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 f67e303 commit 58f1e8b

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ ARG BUILDNUM=""
77
FROM golang:1.17-alpine as builder
88

99
RUN apk add --no-cache make gcc musl-dev linux-headers git bash
10+
# Get dependencies - will also be cached if we won't change go.mod/go.sum
11+
COPY go.mod /go-ethereum/
12+
COPY go.sum /go-ethereum/
13+
RUN cd /go-ethereum && go mod download
1014

1115
ADD . /go-ethereum
1216
RUN cd /go-ethereum && go run build/ci.go install ./cmd/geth

Dockerfile.alltools

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ ARG BUILDNUM=""
77
FROM golang:1.17-alpine as builder
88

99
RUN apk add --no-cache gcc musl-dev linux-headers git
10+
# Get dependencies - will also be cached if we won't change go.mod/go.sum
11+
COPY go.mod /go-ethereum/
12+
COPY go.sum /go-ethereum/
13+
RUN cd /go-ethereum && go mod download
1014

1115
ADD . /go-ethereum
1216
RUN cd /go-ethereum && go run build/ci.go install

0 commit comments

Comments
 (0)