github.com/ethereum/go-ethereum@v1.16.1/Dockerfile.alltools (about)

     1  # Support setting various labels on the final image
     2  ARG COMMIT=""
     3  ARG VERSION=""
     4  ARG BUILDNUM=""
     5  
     6  # Build Geth in a stock Go builder container
     7  FROM golang:1.24-alpine AS builder
     8  
     9  RUN apk add --no-cache gcc musl-dev linux-headers git
    10  
    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  
    16  ADD . /go-ethereum
    17  
    18  # This is not strictly necessary, but it matches the "Dockerfile" steps, thus
    19  # makes it so that under certain circumstances, the docker layer can be cached,
    20  # and the builder can jump to the next (build all) command, with the go cache fully loaded.
    21  #
    22  RUN cd /go-ethereum && go run build/ci.go install -static ./cmd/geth
    23  
    24  RUN cd /go-ethereum && go run build/ci.go install -static
    25  
    26  # Pull all binaries into a second stage deploy alpine container
    27  FROM alpine:latest
    28  
    29  RUN apk add --no-cache ca-certificates
    30  COPY --from=builder /go-ethereum/build/bin/* /usr/local/bin/
    31  
    32  EXPOSE 8545 8546 30303 30303/udp
    33  
    34  # Add some metadata labels to help programmatic image consumption
    35  ARG COMMIT=""
    36  ARG VERSION=""
    37  ARG BUILDNUM=""
    38  
    39  LABEL commit="$COMMIT" version="$VERSION" buildnum="$BUILDNUM"