Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 20 additions & 25 deletions clients/go-ethereum/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down