docker: speed up docker image build (#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
pull/24807/head
EXEC 3 years ago committed by GitHub
parent c153bd40d7
commit 6b60d68344
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      Dockerfile
  2. 5
      Dockerfile.alltools

@ -8,6 +8,11 @@ FROM golang:1.18-alpine as builder
RUN apk add --no-cache gcc musl-dev linux-headers git 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 ADD . /go-ethereum
RUN cd /go-ethereum && go run build/ci.go install ./cmd/geth RUN cd /go-ethereum && go run build/ci.go install ./cmd/geth

@ -8,6 +8,11 @@ FROM golang:1.18-alpine as builder
RUN apk add --no-cache gcc musl-dev linux-headers git 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 ADD . /go-ethereum
RUN cd /go-ethereum && go run build/ci.go install RUN cd /go-ethereum && go run build/ci.go install

Loading…
Cancel
Save