mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 14:46:42 +00:00
Merge remote-tracking branch 'arachnid/dockerize' into s/swarm-docker
This commit is contained in:
commit
71807f3cc5
2 changed files with 68 additions and 0 deletions
28
containers/docker/swarm-alpine/Dockerfile
Normal file
28
containers/docker/swarm-alpine/Dockerfile
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
# Docker container spec for building the swarm 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.
|
||||||
|
FROM alpine:3.3
|
||||||
|
|
||||||
|
# Build go-ethereum on the fly and delete all build tools afterwards
|
||||||
|
RUN \
|
||||||
|
apk add --update go git make gcc musl-dev && \
|
||||||
|
git clone https://github.com/ethersphere/go-ethereum && \
|
||||||
|
(cd go-ethereum && git checkout s/sworm-rc3-update) && \
|
||||||
|
(cd go-ethereum && make geth) && \
|
||||||
|
cp go-ethereum/build/bin/geth /geth && \
|
||||||
|
apk del go git make gcc musl-dev && \
|
||||||
|
rm -rf /go-ethereum && rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
|
# Make sure bash and jq is available for easier wrapper implementation
|
||||||
|
RUN apk add --update bash jq
|
||||||
|
|
||||||
|
# Inject the startup script
|
||||||
|
ADD swarm.sh /swarm.sh
|
||||||
|
RUN chmod +x /swarm.sh
|
||||||
|
|
||||||
|
# Export the usual networking ports to allow outside access to the node
|
||||||
|
EXPOSE 8545 8546 30303
|
||||||
|
|
||||||
|
ENTRYPOINT ["/swarm.sh"]
|
||||||
40
containers/docker/swarm-alpine/swarm.sh
Normal file
40
containers/docker/swarm-alpine/swarm.sh
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Startup script to initialize and boot a go-ethereum instance as a swarm node.
|
||||||
|
#
|
||||||
|
# This script assumes the following files:
|
||||||
|
# - `geth` binary is located in the filesystem root
|
||||||
|
# - `genesis.json` file is located in the filesystem root
|
||||||
|
|
||||||
|
# Immediately abort the script on any error encountered
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ "$SWARM_NETWORK_ID" = "" ]; then export SWARM_NETWORK_ID=322; fi
|
||||||
|
|
||||||
|
if [ ! -f "/swarm/data/nodekey" ]; then
|
||||||
|
# First run
|
||||||
|
echo "Initializing swarm node..."
|
||||||
|
mkdir -p /swarm/data
|
||||||
|
mkdir -p /swarm/enodes
|
||||||
|
mkdir -p /swarm/pids
|
||||||
|
/geth --datadir=/swarm/data --password=<(echo -n) account new
|
||||||
|
fi
|
||||||
|
|
||||||
|
/geth --dev \
|
||||||
|
--maxpeers=40 \
|
||||||
|
--shh=false \
|
||||||
|
--networkid=$SWARM_NETWORK_ID \
|
||||||
|
--bzznoswap \
|
||||||
|
--verbosity=6 \
|
||||||
|
--vmodule=swarm/*=5,discover=5 \
|
||||||
|
--datadir=/swarm/data \
|
||||||
|
--bzzaccount=0 \
|
||||||
|
--unlock=0 \
|
||||||
|
--port=30303 \
|
||||||
|
--bzzport=32200 \
|
||||||
|
--nat=none \
|
||||||
|
--rpc \
|
||||||
|
--rpcaddr="0.0.0.0" \
|
||||||
|
--rpccorsdomain="*" \
|
||||||
|
--password=<(echo -n) \
|
||||||
|
$*
|
||||||
Loading…
Reference in a new issue