Docker c-lightning setup

pull/264/head
Andreas M. Antonopoulos 4 years ago
parent 25a3f35113
commit e793a3dbeb

@ -1,25 +0,0 @@
FROM ubuntu:18.04
# Install development tools prerequisites
RUN apt-get update && apt-get install -y \
build-essential \
libtool \
autotools-dev \
automake \
pkg-config \
python3 \
wget \
git \
curl \
unzip
# Install software-properties-common to add apt repositories
RUN apt-get install -y \
software-properties-common
# c-lightning
RUN add-apt-repository -u ppa:lightningnetwork/ppa
RUN apt-get install -y \
lightningd

@ -0,0 +1,25 @@
FROM lnbook/bitcoind-regtest AS c-lightning-base
# Install software-properties-common to add apt repositories
RUN apt update && apt install -yqq \
software-properties-common
# c-lightning
RUN add-apt-repository -u ppa:lightningnetwork/ppa
RUN apt-get install -y \
lightningd
FROM c-lightning-base AS c-lightning-run
ADD lightningd /lightningd
WORKDIR /lightningd
RUN ln -s /lightningd /root/.lightning
ADD bashrc /root/.bashrc
ADD c-lightning-entrypoint.sh /usr/local/bin
RUN chmod +x /usr/local/bin/c-lightning-entrypoint.sh
ADD fund-c-lightning.sh /usr/local/bin
RUN chmod +x /usr/local/bin/fund-c-lightning.sh
EXPOSE 9735 9835
ENTRYPOINT ["/usr/local/bin/c-lightning-entrypoint.sh"]

@ -0,0 +1,7 @@
#!/bin/bash
set -Eeuo pipefail
lightningd --lightning-dir=/lightningd --daemon
echo "$@"
exec "$@"

@ -0,0 +1,22 @@
#!/bin/bash
set -Eeuo pipefail
# Generate a new receiving address for LND wallet
address=$(lncli --lnddir=/lnd --network regtest newaddress np2wkh | jq .address)
# Ask Bitcoin Core to send 10 BTC to the address, using JSON-RPC call
curl --user regtest:regtest \
-H 'content-type: text/plain;' \
http://bitcoind:18443/ \
--data-binary @- <<EOF
{
"jsonrpc": "1.0",
"id": "lnd-run-container",
"method": "sendtoaddress",
"params": [
${address},
10,
"funding LND"
]
}
EOF

@ -0,0 +1,8 @@
network=regtest
bitcoin-rpcuser=regtest
bitcoin-rpcpassword=regtest
bitcoin-rpcconnect=bitcoind
bitcoin-rpcport=18443
log-level=debug
Loading…
Cancel
Save