Skip to content

Commit

Permalink
docker: speed up docker image build (ethereum#24796)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
eval-exec authored and sadoci committed Jan 27, 2023
1 parent f96abd7 commit b5dab1d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ FROM golang:1.17-alpine as builder

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

# Get dependencies - will also be cached if we won't change go.mod/go.sum
COPY go.mod /go-ethereum/
COPY go.sum /go-ethereum/
RUN cd /go-ethereum && go mod download

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

Expand Down
5 changes: 5 additions & 0 deletions Dockerfile.alltools
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ FROM golang:1.17-alpine as builder

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

# Get dependencies - will also be cached if we won't change go.mod/go.sum
COPY go.mod /go-ethereum/
COPY go.sum /go-ethereum/
RUN cd /go-ethereum && go mod download

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

Expand Down

0 comments on commit b5dab1d

Please sign in to comment.