mirror of
https://github.com/lnbook/lnbook
synced 2024-11-18 21:28:03 +00:00
Docker bitcoind fixes and cleanup
This commit is contained in:
parent
2ef545545e
commit
25a3f35113
@ -19,12 +19,16 @@ ADD $GH_URL/contrib/bitcoin-cli.bash-completion $BC/bitcoin-cli
|
|||||||
ADD $GH_URL/contrib/bitcoind.bash-completion $BC/bitcoind
|
ADD $GH_URL/contrib/bitcoind.bash-completion $BC/bitcoind
|
||||||
ADD $GH_URL/contrib/bitcoin-tx.bash-completion $BC/bitcoin-tx
|
ADD $GH_URL/contrib/bitcoin-tx.bash-completion $BC/bitcoin-tx
|
||||||
|
|
||||||
ADD bashrc /root/.bashrc
|
|
||||||
|
|
||||||
FROM bitcoind-base AS bitcoind-regtest
|
FROM bitcoind-base AS bitcoind-regtest
|
||||||
|
|
||||||
ADD bitcoind /bitcoind
|
ADD bitcoind /bitcoind
|
||||||
RUN ln -s /bitcoind /root/.bitcoin
|
RUN ln -s /bitcoind /root/.
|
||||||
|
|
||||||
|
ADD bashrc /root/.bashrc
|
||||||
|
ADD bitcoind-entrypoint.sh /usr/local/bin
|
||||||
|
RUN chmod +x /usr/local/bin/bitcoind-entrypoint.sh
|
||||||
|
ADD mine.sh /usr/local/bin
|
||||||
|
RUN chmod +x /usr/local/bin/mine.sh
|
||||||
|
|
||||||
# bitcoind P2P
|
# bitcoind P2P
|
||||||
EXPOSE 18444/tcp
|
EXPOSE 18444/tcp
|
||||||
@ -36,5 +40,7 @@ EXPOSE 12005/tcp
|
|||||||
EXPOSE 12006/tcp
|
EXPOSE 12006/tcp
|
||||||
|
|
||||||
WORKDIR /bitcoind
|
WORKDIR /bitcoind
|
||||||
CMD /bin/bash /bitcoind/bitcoind-start.sh \
|
ENTRYPOINT ["/usr/local/bin/bitcoind-entrypoint.sh"]
|
||||||
&& /bin/bash /bitcoind/mine.sh
|
|
||||||
|
# Mine new block every 10 seconds
|
||||||
|
CMD ["/usr/local/bin/mine.sh"]
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
# Use bash-completion, if available
|
# Use bash-completion, if available
|
||||||
|
alias bitcoin-cli="bitcoin-cli -datadir=/bitcoind"
|
||||||
|
|
||||||
[[ $PS1 && -f /usr/share/bash-completion/bash_completion ]] && \
|
[[ $PS1 && -f /usr/share/bash-completion/bash_completion ]] && \
|
||||||
. /usr/share/bash-completion/bash_completion
|
. /usr/share/bash-completion/bash_completion
|
||||||
|
@ -1,7 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
set -Eeuo pipefail
|
||||||
|
|
||||||
|
echo Starting bitcoind...
|
||||||
bitcoind -datadir=/bitcoind -daemon
|
bitcoind -datadir=/bitcoind -daemon
|
||||||
sleep 5
|
until bitcoin-cli -datadir=/bitcoind getblockchaininfo > /dev/null 2>&1
|
||||||
|
do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
echo bitcoind started
|
||||||
export address=`cat /bitcoind/keys/demo_address.txt`
|
export address=`cat /bitcoind/keys/demo_address.txt`
|
||||||
export privkey=`cat /bitcoind/keys/demo_privkey.txt`
|
export privkey=`cat /bitcoind/keys/demo_privkey.txt`
|
||||||
echo "================================================"
|
echo "================================================"
|
||||||
@ -10,3 +16,7 @@ echo "Bitcoin address: " ${address}
|
|||||||
echo "Private key: " ${privkey}
|
echo "Private key: " ${privkey}
|
||||||
echo "================================================"
|
echo "================================================"
|
||||||
bitcoin-cli -datadir=/bitcoind importprivkey $privkey
|
bitcoin-cli -datadir=/bitcoind importprivkey $privkey
|
||||||
|
|
||||||
|
# Executing CMD
|
||||||
|
echo "$@"
|
||||||
|
exec "$@"
|
@ -1,4 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
set -Eeuo pipefail
|
||||||
|
|
||||||
export address=`cat /bitcoind/keys/demo_address.txt`
|
export address=`cat /bitcoind/keys/demo_address.txt`
|
||||||
export privkey=`cat /bitcoind/keys/demo_privkey.txt`
|
export privkey=`cat /bitcoind/keys/demo_privkey.txt`
|
||||||
@ -14,3 +15,6 @@ while sleep 10; do \
|
|||||||
bitcoin-cli -datadir=/bitcoind generatetoaddress 1 $address; \
|
bitcoin-cli -datadir=/bitcoind generatetoaddress 1 $address; \
|
||||||
echo "Balance:" `bitcoin-cli -datadir=/bitcoind getbalance`; \
|
echo "Balance:" `bitcoin-cli -datadir=/bitcoind getbalance`; \
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# If loop is interrupted, stop bitcoind
|
||||||
|
bitcoin-cli -datadir=/bitcoind stop
|
Loading…
Reference in New Issue
Block a user