mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 14:46:42 +00:00
feat: upgrade Containerfile to use stagex
This commit is contained in:
parent
0db99f4e40
commit
782faf908d
1 changed files with 15 additions and 15 deletions
30
Dockerfile
30
Dockerfile
|
|
@ -3,31 +3,31 @@ ARG COMMIT=""
|
||||||
ARG VERSION=""
|
ARG VERSION=""
|
||||||
ARG BUILDNUM=""
|
ARG BUILDNUM=""
|
||||||
|
|
||||||
# Build Geth in a stock Go builder container
|
FROM stagex/core-ca-certificates@sha256:d6fca6c0080e8e5360cd85fc1c4bd3eab71ce626f40602e38488bfd61fd3e89d AS ca-certificates
|
||||||
FROM golang:1.24-alpine AS builder
|
|
||||||
|
|
||||||
RUN apk add --no-cache gcc musl-dev linux-headers git
|
# Build Geth using a hermetic, full-source bootstrapped and deterministic toolchain
|
||||||
|
FROM stagex/pallet-go@sha256:7ffeced176cf8c3035d918618ade8b824f9553ade8b0510df55df9012f35b0a8 AS build
|
||||||
|
|
||||||
# Get dependencies - will also be cached if we won't change go.mod/go.sum
|
# Get dependencies - will also be cached if we won't change go.mod/go.sum
|
||||||
COPY go.mod /go-ethereum/
|
WORKDIR /go-ethereum
|
||||||
COPY go.sum /go-ethereum/
|
COPY go.mod go.sum ./
|
||||||
RUN cd /go-ethereum && go mod download
|
RUN go mod download
|
||||||
|
COPY . .
|
||||||
|
|
||||||
ADD . /go-ethereum
|
RUN --network=none <<-EOF
|
||||||
RUN cd /go-ethereum && go run build/ci.go install -static ./cmd/geth
|
go run build/ci.go install -static ./cmd/geth
|
||||||
|
EOF
|
||||||
# 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/
|
|
||||||
|
|
||||||
|
# Pull Geth into a clean layer with only required dependencies
|
||||||
|
FROM scratch
|
||||||
|
COPY --from=ca-certificates . /
|
||||||
|
COPY --from=build /go-ethereum/build/bin/geth /usr/bin/geth
|
||||||
EXPOSE 8545 8546 30303 30303/udp
|
EXPOSE 8545 8546 30303 30303/udp
|
||||||
|
|
||||||
ENTRYPOINT ["geth"]
|
ENTRYPOINT ["geth"]
|
||||||
|
|
||||||
# Add some metadata labels to help programmatic image consumption
|
# Add some metadata labels to help programmatic image consumption
|
||||||
ARG COMMIT=""
|
ARG COMMIT=""
|
||||||
ARG VERSION=""
|
ARG VERSION=""
|
||||||
ARG BUILDNUM=""
|
ARG BUILDNUM=""
|
||||||
|
|
||||||
LABEL commit="$COMMIT" version="$VERSION" buildnum="$BUILDNUM"
|
LABEL commit="$COMMIT" version="$VERSION" buildnum="$BUILDNUM"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue