diff --git a/code/docker/lnd-run/Dockerfile b/code/docker/lnd-run/Dockerfile index de69aed..f3af728 100644 --- a/code/docker/lnd-run/Dockerfile +++ b/code/docker/lnd-run/Dockerfile @@ -2,8 +2,14 @@ FROM lnbook/lnd-base ADD lnd /lnd RUN ln -s /lnd /root/.lnd +ADD fund-lnd.sh /usr/local/bin +RUN chmod +x /usr/local/bin/fund-lnd.sh +ADD bashrc /root/.bashrc +ADD lnd-entrypoint.sh /usr/local/bin +RUN chmod +x /usr/local/bin/lnd-entrypoint.sh WORKDIR /lnd -CMD /bin/bash lnd-start.sh \ - && sleep 5 \ - && /bin/bash fund-lnd.sh +ENTRYPOINT ["/usr/local/bin/lnd-entrypoint.sh"] + +# Show lnd logs from beginning and keep following +CMD ["tail", "-n", "+1", "-f", "/lnd/logs/bitcoin/regtest/lnd.log"] diff --git a/code/docker/lnd-run/bashrc b/code/docker/lnd-run/bashrc new file mode 100644 index 0000000..fc12561 --- /dev/null +++ b/code/docker/lnd-run/bashrc @@ -0,0 +1 @@ +alias lncli="lncli --lnddir=/lnd -n regtest" diff --git a/code/docker/lnd-run/lnd/fund-lnd.sh b/code/docker/lnd-run/fund-lnd.sh similarity index 100% rename from code/docker/lnd-run/lnd/fund-lnd.sh rename to code/docker/lnd-run/fund-lnd.sh diff --git a/code/docker/lnd-run/lnd-entrypoint.sh b/code/docker/lnd-run/lnd-entrypoint.sh new file mode 100644 index 0000000..a7d73f8 --- /dev/null +++ b/code/docker/lnd-run/lnd-entrypoint.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +echo Starting lnd... +lnd --lnddir=/lnd --noseedbackup > /dev/null & +sleep 5 +until lncli --lnddir=/lnd -n regtest getinfo > /dev/null 2>&1 +do + sleep 1 +done +echo "Startup complete" +echo "Funding lnd wallet" +source /usr/local/bin/fund-lnd.sh + +exec "$@" diff --git a/code/docker/lnd-run/lnd/lnd-start.sh b/code/docker/lnd-run/lnd/lnd-start.sh deleted file mode 100644 index 9c0cb99..0000000 --- a/code/docker/lnd-run/lnd/lnd-start.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -lnd --lnddir=/lnd --noseedbackup