feat: allow docker compose overrides

- use file override to handle multiple networks
- expose and map only required ports
- name containers differently
- add environment for chain variable
- dont expose ports in image
Signed-off-by: Lakshya Singh <lakshay.singh1108@gmail.com>
This commit is contained in:
Lakshya Singh 2023-09-26 00:40:53 +05:30
parent 0484ff6475
commit 5b0cb901cb
No known key found for this signature in database
GPG Key ID: D3239BA6109A2CE7
5 changed files with 68 additions and 28 deletions

View File

@ -121,8 +121,6 @@ RUN chmod +x /healthcheck.sh
VOLUME ["${BITCOIN_DATA}"]
EXPOSE 8332 8333 18332 18333 18444
RUN mkdir -p "${BITCOIN_DATA}"
RUN chown -R bitcoin:bitcoin "${BITCOIN_DATA}"

View File

@ -0,0 +1,25 @@
version: "3.8"
name: main
services:
bitcoin-core:
container_name: bitcoind-main
expose:
- 8332
ports:
- 8333:8333
environment:
- BITCOIN_CHAIN=main
core-lightning:
container_name: lightningd-main
command:
- --conf=/home/lightning/.lightning/main-config
- --bitcoin-rpcconnect=bitcoind
expose:
- 9735
ports:
- 9735:9735
env_file:
- ./assets/main-env
environment:
- BITCOIN_CHAIN=main

View File

@ -0,0 +1,25 @@
version: "3.8"
name: regtest
services:
bitcoin-core:
container_name: bitcoind-regtest
expose:
- 38332
ports:
- 38333:38333
environment:
- BITCOIN_CHAIN=regtest
core-lightning:
container_name: lightningd-regtest
command:
- --conf=/home/lightning/.lightning/regtest-config
- --bitcoin-rpcconnect=bitcoind
expose:
- 19846
ports:
- 19846:19846
env_file:
- ./assets/regtest-env
environment:
- BITCOIN_CHAIN=regtest

View File

@ -0,0 +1,10 @@
version: "3.8"
name: testnet
services:
bitcoin-core:
ports:
- 18333:18333
core-lightning:
ports:
- 19735:19735

View File

@ -4,22 +4,11 @@ services:
build:
dockerfile: ./bitcoind/Dockerfile
image: bitcoind
container_name: bitcoind
command:
- --testnet
- -pid=/home/bitcoin/.bitcoin/testnet3/bitcoind-testnet.pid
container_name: bitcoind-test
volumes:
- data:/home/bitcoin/.bitcoin
expose:
- 8332
- 8333
- 18332
- 18333
- 18444
ports:
- 8333:8333
- 18333:18333
- 38333:38333
networks:
LN_testing:
aliases:
@ -31,31 +20,24 @@ services:
build:
dockerfile: ./lightningd/Dockerfile
image: lightningd
container_name: lightningd
container_name: lightningd-test
command:
- --conf=/home/lightning/.lightning/testnet-config
- --conf=/home/lightning/.lightning/test-config
- --bitcoin-rpcconnect=bitcoind
- --bind-addr=core-lightning:19735
- --announce-addr=core-lightning:19735
volumes:
- clightning:/home/lightning/.lightning
expose:
- 9735
- 9835
ports:
- 9735:9735
- 19735:19735
- 19735
networks:
- LN_testing
links:
- bitcoin-core:bitcoind
depends_on:
bitcoin-core:
condition: service_healthy
restart: true
env_file:
- ./assets/testnet-env
- ./assets/test-env
environment:
- BITCOIN_CHAIN=test
volumes:
data: