mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 02:40:45 +00:00
refactor bootnode docker
This commit is contained in:
parent
4962300b5e
commit
f6fff81c00
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 . /XDCchain
|
ADD . /XDCchain
|
||||||
RUN cd /XDCchain && make bootnode
|
RUN cd /XDCchain && make bootnode
|
||||||
|
|
||||||
|
RUN chmod +x /XDCchain/build/bin/bootnode
|
||||||
|
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
|
|
||||||
LABEL maintainer="admin@xinfin.org"
|
LABEL maintainer="admin@xinfin.org"
|
||||||
|
|
@ -13,10 +15,10 @@ WORKDIR /XDCchain
|
||||||
|
|
||||||
COPY --from=builder /XDCchain/build/bin/bootnode /usr/local/bin/bootnode
|
COPY --from=builder /XDCchain/build/bin/bootnode /usr/local/bin/bootnode
|
||||||
|
|
||||||
RUN chmod +x /usr/local/bin/bootnode
|
COPY docker/bootnode ./
|
||||||
|
|
||||||
EXPOSE 30301
|
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
Normal file
24
docker/bootnode/entrypoint.sh
Normal 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