Dockerfile 897 B

123456789101112131415161718192021222324252627282930313233
  1. # Support setting various labels on the final image
  2. ARG COMMIT=""
  3. ARG VERSION=""
  4. ARG BUILDNUM=""
  5. # Build Geth in a stock Go builder container
  6. FROM golang:1.18-alpine as builder
  7. RUN apk add --no-cache gcc musl-dev linux-headers git
  8. # Get dependencies - will also be cached if we won't change go.mod/go.sum
  9. COPY go.mod /go-ethereum/
  10. COPY go.sum /go-ethereum/
  11. RUN cd /go-ethereum && go mod download
  12. ADD . /go-ethereum
  13. RUN cd /go-ethereum && go run build/ci.go install -static ./cmd/geth
  14. # Pull Geth into a second stage deploy alpine container
  15. FROM alpine:latest
  16. RUN apk add --no-cache ca-certificates
  17. COPY --from=builder /go-ethereum/build/bin/geth /usr/local/bin/
  18. EXPOSE 8545 8546 30303 30303/udp
  19. ENTRYPOINT ["geth"]
  20. # Add some metadata labels to help programatic image consumption
  21. ARG COMMIT=""
  22. ARG VERSION=""
  23. ARG BUILDNUM=""
  24. LABEL commit="$COMMIT" version="$VERSION" buildnum="$BUILDNUM"