mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 01:13:45 +00:00
update dockerile to use stagex
This commit is contained in:
parent
8a14362bf7
commit
ad19ed83d4
1 changed files with 15 additions and 26 deletions
41
Dockerfile
41
Dockerfile
|
|
@ -1,33 +1,22 @@
|
|||
# Support setting various labels on the final image
|
||||
ARG COMMIT=""
|
||||
ARG VERSION=""
|
||||
ARG BUILDNUM=""
|
||||
|
||||
# Build Geth in a stock Go builder container
|
||||
FROM golang:1.24-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 -static ./cmd/geth
|
||||
|
||||
# Pull Geth into a second stage deploy alpine container
|
||||
FROM alpine:latest
|
||||
|
||||
RUN apk add --no-cache ca-certificates
|
||||
COPY --from=builder /go-ethereum/build/bin/geth /usr/local/bin/
|
||||
FROM stagex/pallet-go:2025.02.0@sha256:fb2a63e3ed8756e845ceb44ff8fe57493ba15fc84f75f09487359932e089eea3 AS build
|
||||
WORKDIR /go-ethereum
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
COPY . .
|
||||
RUN --network=none <<-EOF
|
||||
go run build/ci.go install -static ./cmd/geth
|
||||
mkdir -p /rootfs/usr/share/ca-cetificates
|
||||
cp -r /usr/share/ca-certificates/* /rootfs/
|
||||
EOF
|
||||
|
||||
FROM scratch
|
||||
COPY --from=build /rootfs/* /
|
||||
COPY --from=build /go-ethereum/build/bin/geth /usr/bin/geth
|
||||
EXPOSE 8545 8546 30303 30303/udp
|
||||
|
||||
ENTRYPOINT ["geth"]
|
||||
|
||||
# Add some metadata labels to help programmatic image consumption
|
||||
ARG COMMIT=""
|
||||
ARG VERSION=""
|
||||
ARG BUILDNUM=""
|
||||
|
||||
LABEL commit="$COMMIT" version="$VERSION" buildnum="$BUILDNUM"
|
||||
LABEL commit="$COMMIT" version="$VERSION" buildnum="$BUILDNUM"
|
||||
Loading…
Reference in a new issue