diff --git a/Dockerfile b/Dockerfile index 3c59d642df..0bdc467684 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,7 @@ +# Support setting various labels on the final image +ARG COMMIT="" +ARG VERSION="" +ARG BUILDNUM="" # Base Geth build stage remains the same # Additional stage for Blockscout dependencies @@ -19,13 +23,25 @@ RUN mix do ecto.create, ecto.migrate RUN mix phx.digest && MIX_ENV=prod mix release +# 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 + # Final image FROM alpine:latest RUN apk add --no-cache ca-certificates libstdc++ postgresql-client su-exec bash curl -#COPY --from=builder /go-ethereum/build/bin/geth /usr/local/bin/ -COPY --from=geth-builder /go-ethereum/build/bin/geth /usr/local/bin/ +COPY --from=builder /go-ethereum/build/bin/geth /usr/local/bin/ COPY --from=blockscout-builder /blockscout /blockscout @@ -34,4 +50,4 @@ COPY start.sh /start.sh RUN chmod +x /start.sh EXPOSE 8545 8546 30303 4000 -ENTRYPOINT ["/bin/sh", "/start.sh"] +ENTRYPOINT ["/bin/sh", "/start.sh"] \ No newline at end of file