From 3f3af4b3d05623634fb5e832a29a27a85a3f8a1f Mon Sep 17 00:00:00 2001 From: nothing-stops-this-train Date: Wed, 14 Jan 2026 13:50:34 -0800 Subject: [PATCH 1/2] Create btc-ln.yml --- generator/docker-components/btc-ln.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 generator/docker-components/btc-ln.yml diff --git a/generator/docker-components/btc-ln.yml b/generator/docker-components/btc-ln.yml new file mode 100644 index 0000000..d7fb407 --- /dev/null +++ b/generator/docker-components/btc-ln.yml @@ -0,0 +1,8 @@ +services: + bitcoin: + environment: + BTC_LIGHTNING_LISTEN: "0.0.0.0:9735" + ports: + - "9735:9735" + expose: + - "9735" From 1c71cb77d9b5484cd836257ec51e690b5ffd4c4c Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 5 May 2026 16:23:03 -0700 Subject: [PATCH 2/2] Add BTCLND component for LND daemon Wires the new bitcart-btclnd daemon into the docker-compose generator: - generator/docker-components/bitcoinlnd.yml: new component, mirrors the bitcoin component but exposes the JSON-RPC port 5012 internally and publishes 9735-9744 for lightning peer P2P (per-wallet inbound). - generator/constants.py: register btclnd in the CRYPTOS map so the generator picks up the new component. - dev-setup.sh: add BTCLND_HOST=bitcoinlnd to the dev .env heredoc. - compose/btclnd.Dockerfile: new image. Multi-stage alpine build installs the python btclnd group plus runtime tor/curl. The LND binary is intentionally NOT baked into the image - the daemon fetches and caches it on first start under the /data volume (see daemons/lnd_process.py:LNDBinaryManager), keeping a single version pin in the daemon code and avoiding ~50MB of image bloat. Note: existing compose/*.Dockerfile files are auto-generated from compose/Dockerfile-coin.template via compose/scripts/generate-templates.sh. btclnd needs an LND-specific runtime apk add and (in future) optional template support for fetched binaries; for now the Dockerfile is hand-written and exempted from regeneration de facto by not adding btclnd to bitcart/.github/images.json. Proper template integration is a follow-up. Co-Authored-By: Claude Opus 4.7 (1M context) --- compose/btclnd.Dockerfile | 50 ++++++++++++++++++++++ dev-setup.sh | 1 + generator/constants.py | 1 + generator/docker-components/bitcoinlnd.yml | 29 +++++++++++++ 4 files changed, 81 insertions(+) create mode 100644 compose/btclnd.Dockerfile create mode 100644 generator/docker-components/bitcoinlnd.yml diff --git a/compose/btclnd.Dockerfile b/compose/btclnd.Dockerfile new file mode 100644 index 0000000..b376c7b --- /dev/null +++ b/compose/btclnd.Dockerfile @@ -0,0 +1,50 @@ +# +# Dockerfile for bitcart-btclnd daemon +# +# The LND binary itself is fetched at runtime by the daemon +# (see daemons/lnd_process.py:LNDBinaryManager) and cached on the +# data volume, so it is intentionally NOT baked into the image. +# + +FROM python:3.12-alpine AS base +COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ + +ENV ELECTRUM_USER=electrum +ENV ELECTRUM_HOME=/home/$ELECTRUM_USER +ENV ELECTRUM_DIRECTORY=${ELECTRUM_HOME}/.bitcart-btclnd +ENV IN_DOCKER=1 +ENV UV_COMPILE_BYTECODE=1 +ENV UV_NO_CACHE=1 +ENV UV_NO_SYNC=1 +ENV BTCLND_HOST=0.0.0.0 +LABEL org.bitcart.image=btclnd-daemon + +FROM base AS compile-image + +COPY bitcart $ELECTRUM_HOME/site + +RUN apk add git python3-dev build-base libffi-dev && \ + cd $ELECTRUM_HOME/site && \ + uv sync --frozen --no-dev --group btclnd --group otel && \ + uv run opentelemetry-bootstrap -a requirements | uv pip install --requirement - + +FROM base AS build-image + +RUN adduser -D $ELECTRUM_USER && \ + mkdir -p /data/ && \ + ln -sf /data/ $ELECTRUM_DIRECTORY && \ + chown ${ELECTRUM_USER} $ELECTRUM_DIRECTORY && \ + mkdir -p $ELECTRUM_HOME/site && \ + chown ${ELECTRUM_USER} $ELECTRUM_HOME/site && \ + apk add --no-cache libsecp256k1-dev git tor curl && \ + apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/main jemalloc + +COPY --from=compile-image --chown=electrum $ELECTRUM_HOME/site/.venv $ELECTRUM_HOME/.venv +COPY --from=compile-image --chown=electrum $ELECTRUM_HOME/site $ELECTRUM_HOME/site + +ENV PYTHONUNBUFFERED=1 PYTHONMALLOC=malloc LD_PRELOAD=libjemalloc.so.2 MALLOC_CONF=background_thread:true,max_background_threads:1,metadata_thp:auto,dirty_decay_ms:80000,muzzy_decay_ms:80000 +ENV PATH="$ELECTRUM_HOME/.venv/bin:$PATH" +USER $ELECTRUM_USER +WORKDIR $ELECTRUM_HOME/site + +CMD ["just","daemon", "btclnd"] diff --git a/dev-setup.sh b/dev-setup.sh index 4e172a4..7b7e60a 100755 --- a/dev-setup.sh +++ b/dev-setup.sh @@ -13,6 +13,7 @@ cat >conf/.env <