mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
Merge pull request #172 from tomochain/feature/docker-bootnode
Refactor bootnode docker
This commit is contained in:
commit
7c7895a8d3
3 changed files with 29 additions and 3 deletions
|
|
@ -5,6 +5,8 @@ RUN apk add --no-cache make gcc musl-dev linux-headers
|
|||
ADD . /tomochain
|
||||
RUN cd /tomochain && make bootnode
|
||||
|
||||
RUN chmod +x /tomochain/build/bin/bootnode
|
||||
|
||||
FROM alpine:latest
|
||||
|
||||
LABEL maintainer="etienne@tomochain.com"
|
||||
|
|
@ -13,10 +15,10 @@ WORKDIR /tomochain
|
|||
|
||||
COPY --from=builder /tomochain/build/bin/bootnode /usr/local/bin/bootnode
|
||||
|
||||
RUN chmod +x /usr/local/bin/bootnode
|
||||
COPY docker/bootnode ./
|
||||
|
||||
EXPOSE 30301
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/bootnode"]
|
||||
ENTRYPOINT ["./entrypoint.sh"]
|
||||
|
||||
CMD ["--help"]
|
||||
CMD ["-verbosity", "6", "-nodekey", "bootnode.key", "--addr", ":30301"]
|
||||
|
|
|
|||
0
docker/bootnode/bootnodes/bootnodes
Normal file
0
docker/bootnode/bootnodes/bootnodes
Normal file
24
docker/bootnode/entrypoint.sh
Executable file
24
docker/bootnode/entrypoint.sh
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh -x
|
||||
|
||||
# file to env
|
||||
for env in PRIVATE_KEY; do
|
||||
file=$(eval echo "\$${env}_FILE")
|
||||
if [[ -f $file ]] && [[ ! -z $file ]]; then
|
||||
echo "Replacing $env by $file"
|
||||
export $env=$(cat $file)
|
||||
fi
|
||||
done
|
||||
|
||||
# private key
|
||||
if [[ ! -z "$PRIVATE_KEY" ]]; then
|
||||
echo "$PRIVATE_KEY" > bootnode.key
|
||||
elif [[ ! -f ./bootnode.key ]]; then
|
||||
bootnode -genkey bootnode.key
|
||||
fi
|
||||
|
||||
# dump address
|
||||
address="enode://$(bootnode -nodekey bootnode.key -writeaddress)@[$(hostname -i)]:30301"
|
||||
|
||||
echo "$address" > ./bootnodes/bootnodes
|
||||
|
||||
exec bootnode "$@"
|
||||
Loading…
Reference in a new issue