Skip to content

Commit 71807f3

Browse files
committed
Merge remote-tracking branch 'arachnid/dockerize' into s/swarm-docker
2 parents 6e75ca9 + 8eb7c7f commit 71807f3

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Docker container spec for building the swarm branch of go-ethereum.
2+
#
3+
# The build process it potentially longer running but every effort was made to
4+
# produce a very minimalistic container that can be reused many times without
5+
# needing to constantly rebuild.
6+
FROM alpine:3.3
7+
8+
# Build go-ethereum on the fly and delete all build tools afterwards
9+
RUN \
10+
apk add --update go git make gcc musl-dev && \
11+
git clone https://github.com/ethersphere/go-ethereum && \
12+
(cd go-ethereum && git checkout s/sworm-rc3-update) && \
13+
(cd go-ethereum && make geth) && \
14+
cp go-ethereum/build/bin/geth /geth && \
15+
apk del go git make gcc musl-dev && \
16+
rm -rf /go-ethereum && rm -rf /var/cache/apk/*
17+
18+
# Make sure bash and jq is available for easier wrapper implementation
19+
RUN apk add --update bash jq
20+
21+
# Inject the startup script
22+
ADD swarm.sh /swarm.sh
23+
RUN chmod +x /swarm.sh
24+
25+
# Export the usual networking ports to allow outside access to the node
26+
EXPOSE 8545 8546 30303
27+
28+
ENTRYPOINT ["/swarm.sh"]
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
3+
# Startup script to initialize and boot a go-ethereum instance as a swarm node.
4+
#
5+
# This script assumes the following files:
6+
# - `geth` binary is located in the filesystem root
7+
# - `genesis.json` file is located in the filesystem root
8+
9+
# Immediately abort the script on any error encountered
10+
set -e
11+
12+
if [ "$SWARM_NETWORK_ID" = "" ]; then export SWARM_NETWORK_ID=322; fi
13+
14+
if [ ! -f "/swarm/data/nodekey" ]; then
15+
# First run
16+
echo "Initializing swarm node..."
17+
mkdir -p /swarm/data
18+
mkdir -p /swarm/enodes
19+
mkdir -p /swarm/pids
20+
/geth --datadir=/swarm/data --password=<(echo -n) account new
21+
fi
22+
23+
/geth --dev \
24+
--maxpeers=40 \
25+
--shh=false \
26+
--networkid=$SWARM_NETWORK_ID \
27+
--bzznoswap \
28+
--verbosity=6 \
29+
--vmodule=swarm/*=5,discover=5 \
30+
--datadir=/swarm/data \
31+
--bzzaccount=0 \
32+
--unlock=0 \
33+
--port=30303 \
34+
--bzzport=32200 \
35+
--nat=none \
36+
--rpc \
37+
--rpcaddr="0.0.0.0" \
38+
--rpccorsdomain="*" \
39+
--password=<(echo -n) \
40+
$*

0 commit comments

Comments
 (0)