diff --git a/clients/go-ethereum/Dockerfile b/clients/go-ethereum/Dockerfile index 27564e7d18..6a67bbdfa9 100644 --- a/clients/go-ethereum/Dockerfile +++ b/clients/go-ethereum/Dockerfile @@ -1,45 +1,40 @@ -# Docker container spec for building the master branch of go-ethereum. -# -# The build process it potentially longer running but every effort was made to -# produce a very minimalistic container that can be reused many times without -# needing to constantly rebuild. +## By default, the geth is pulled from Docker Hub. ARG branch=latest -FROM ethereum/client-go:$branch +FROM ethereum/client-go:$branch as builder -RUN apk add --update bash curl jq +## ---- +## Uncomment the steps below (and comment out the steps above!) to build go-ethereum +## from local sources in the ./go-ethereum directory. -# FROM alpine:latest +# FROM golang:1-alpine as builder # ARG branch=master +# ADD go-ethereum /go-ethereum +# WORKDIR /go-ethereum +# RUN apk add --update bash curl jq git make +# RUN make geth +# RUN mv ./build/bin/geth /usr/local/bin/geth -# Build go-ethereum on the fly and delete all build tools afterwards -# RUN \ -# apk add --update bash curl jq go git make gcc musl-dev \ -# ca-certificates linux-headers && \ -# git clone --depth 1 --branch $branch https://github.com/ethereum/go-ethereum && \ -# (cd go-ethereum && make geth) && \ -# (cd go-ethereum && \ -# echo "{}" \ -# | jq ".+ {\"repo\":\"$(git config --get remote.origin.url)\"}" \ -# | jq ".+ {\"branch\":\"$(git rev-parse --abbrev-ref HEAD)\"}" \ -# | jq ".+ {\"commit\":\"$(git rev-parse HEAD)\"}" \ -# > /version.json) && \ -# cp go-ethereum/build/bin/geth /geth && \ -# apk del go git make gcc musl-dev linux-headers && \ -# rm -rf /go-ethereum && rm -rf /var/cache/apk/* +## ---- +FROM alpine:latest +RUN apk add --update bash jq +COPY --from=builder /usr/local/bin/geth /usr/local/bin/geth + +# Generate the version.txt file. RUN /usr/local/bin/geth console --exec 'console.log(admin.nodeInfo.name)' --maxpeers=0 --nodiscover --dev 2>/dev/null | head -1 > /version.txt -# Inject the startup script +# Inject the startup script. ADD geth.sh /geth.sh ADD mapper.jq /mapper.jq RUN chmod +x /geth.sh -# Inject the enode id retriever script +# Inject the enode id retriever script. RUN mkdir /hive-bin ADD enode.sh /hive-bin/enode.sh RUN chmod +x /hive-bin/enode.sh +# Add a default genesis file. ADD genesis.json /genesis.json # Export the usual networking ports to allow outside access to the node