From 5d2b748363be8543e6f8d420333af5d818c2f868 Mon Sep 17 00:00:00 2001 From: cry Date: Fri, 26 Sep 2025 11:26:12 +0000 Subject: [PATCH] support arm64 --- test/Dockerfile.beacon-chain | 42 +++++++++++++++++++++++++++++++++ test/Dockerfile.prysmctl | 45 ++++++++++++++++++++++++++++++++++++ test/Dockerfile.validator | 42 +++++++++++++++++++++++++++++++++ test/docker-compose.yml | 12 +++++++--- 4 files changed, 138 insertions(+), 3 deletions(-) create mode 100644 test/Dockerfile.beacon-chain create mode 100644 test/Dockerfile.prysmctl create mode 100644 test/Dockerfile.validator diff --git a/test/Dockerfile.beacon-chain b/test/Dockerfile.beacon-chain new file mode 100644 index 0000000000000..122e746206674 --- /dev/null +++ b/test/Dockerfile.beacon-chain @@ -0,0 +1,42 @@ +# Multi-stage Docker build for beacon-chain binary +# Stage 1: Build the Go binary +FROM golang:1.20.9-alpine AS builder + +# Install git, ca-certificates and build dependencies for CGO +RUN apk add --no-cache git ca-certificates gcc musl-dev g++ + +# Set working directory +WORKDIR /app + +# Clone source code from GitHub +ARG GIT_COMMIT=v4.1.1 +RUN git clone https://github.com/prysmaticlabs/prysm.git . && \ + git checkout $GIT_COMMIT + +# Download dependencies +RUN go mod download + +# Build the beacon-chain binary with CGO enabled +RUN CGO_ENABLED=1 GOOS=linux go build \ + -a -installsuffix cgo \ + -ldflags="-w -s" \ + -o beacon-chain \ + ./cmd/beacon-chain + +# Stage 2: Create the final minimal image +FROM alpine:latest + +# Install ca-certificates and libstdc++ for HTTPS requests and C++ runtime +RUN apk --no-cache add ca-certificates libstdc++ + +# Set working directory +WORKDIR /root + +# Copy the binary from builder stage +COPY --from=builder /app/beacon-chain /usr/local/bin/ + +# Set the entrypoint +ENTRYPOINT ["beacon-chain"] + +# Default command shows help +CMD ["--help"] diff --git a/test/Dockerfile.prysmctl b/test/Dockerfile.prysmctl new file mode 100644 index 0000000000000..03ed8dda67b26 --- /dev/null +++ b/test/Dockerfile.prysmctl @@ -0,0 +1,45 @@ +# Multi-stage Docker build for prysmctl binary +# Stage 1: Build the Go binary +FROM golang:1.21.5-alpine AS builder + +# Install git, ca-certificates and build dependencies for CGO +RUN apk add --no-cache git ca-certificates gcc musl-dev g++ + +# Set working directory +WORKDIR /app + +# Clone source code from GitHub +ARG GIT_COMMIT=aec349f75 +RUN git clone https://github.com/prysmaticlabs/prysm.git . && \ + git checkout $GIT_COMMIT + +# Download dependencies +RUN go mod download + +# Build the prysmctl binary with CGO enabled +RUN CGO_ENABLED=1 GOOS=linux go build \ + -a -installsuffix cgo \ + -ldflags="-w -s" \ + -o prysmctl \ + ./cmd/prysmctl + +# Stage 2: Create the final minimal image +FROM alpine:latest + +# Install ca-certificates and libstdc++ for HTTPS requests and C++ runtime +RUN apk --no-cache add ca-certificates libstdc++ + + +# Set working directory +WORKDIR /root + +# Copy the binary from builder stage +COPY --from=builder /app/prysmctl /usr/local/bin/prysmctl + + + +# Set the entrypoint +ENTRYPOINT ["prysmctl"] + +# Default command shows help +CMD ["--help"] diff --git a/test/Dockerfile.validator b/test/Dockerfile.validator new file mode 100644 index 0000000000000..716339aa3263e --- /dev/null +++ b/test/Dockerfile.validator @@ -0,0 +1,42 @@ +# Multi-stage Docker build for validator binary +# Stage 1: Build the Go binary +FROM golang:1.20.9-alpine AS builder + +# Install git, ca-certificates and build dependencies for CGO +RUN apk add --no-cache git ca-certificates gcc musl-dev g++ + +# Set working directory +WORKDIR /app + +# Clone source code from GitHub +ARG GIT_COMMIT=v4.1.1 +RUN git clone https://github.com/prysmaticlabs/prysm.git . && \ + git checkout $GIT_COMMIT + +# Download dependencies +RUN go mod download + +# Build the validator binary with CGO enabled +RUN CGO_ENABLED=1 GOOS=linux go build \ + -a -installsuffix cgo \ + -ldflags="-w -s" \ + -o validator \ + ./cmd/validator + +# Stage 2: Create the final minimal image +FROM alpine:latest + +# Install ca-certificates and libstdc++ for HTTPS requests and C++ runtime +RUN apk --no-cache add ca-certificates libstdc++ + +# Set working directory +WORKDIR /root + +# Copy the binary from builder stage +COPY --from=builder /app/validator /usr/local/bin/ + +# Set the entrypoint +ENTRYPOINT ["validator"] + +# Default command shows help +CMD ["--help"] diff --git a/test/docker-compose.yml b/test/docker-compose.yml index 1dd13e39a1b77..6fc851c222224 100644 --- a/test/docker-compose.yml +++ b/test/docker-compose.yml @@ -18,7 +18,9 @@ services: - ./l1-geth/consensus:/consensus l1-create-beacon-chain-genesis: - image: "gcr.io/prysmaticlabs/prysm/cmd/prysmctl:HEAD-aec349" + build: + context: . + dockerfile: Dockerfile.prysmctl container_name: l1-create-beacon-chain-genesis command: - testnet @@ -112,7 +114,9 @@ services: retries: 5 l1-beacon-chain: - image: "gcr.io/prysmaticlabs/prysm/beacon-chain:v4.1.1" + build: + context: . + dockerfile: Dockerfile.beacon-chain container_name: l1-beacon-chain command: - --datadir=/consensus/beacondata @@ -149,7 +153,9 @@ services: - ./l1-geth/execution/jwtsecret:/execution/jwtsecret l1-validator: - image: "gcr.io/prysmaticlabs/prysm/validator:v4.1.1" + build: + context: . + dockerfile: Dockerfile.validator container_name: l1-validator command: - --beacon-rpc-provider=l1-beacon-chain:4000