Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and push multi-platform docker images
name: Publish multi-platform docker images

on:
push:
Expand Down Expand Up @@ -30,6 +30,14 @@ on:
jobs:
build:
runs-on: ubuntu-22.04
strategy:
fail-fast: false # Let each tag finish.
matrix:
include:
- target: lightningd
tag_suffix: ''
- target: lightningd-vls-signer
tag_suffix: '-vls'

steps:
- name: Checkout repository
Expand All @@ -50,7 +58,7 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Set up values
- name: Set up values for ${{ matrix.target }}
id: set-values
run: |
if [[ "${{ github.event.inputs.version }}" != "" ]]; then
Expand Down Expand Up @@ -89,14 +97,16 @@ jobs:
fi
echo "PUSHLATEST=$PUSHLATEST" >> $GITHUB_ENV

TAGS="$REPONAME/lightningd:$VERSION"
TAGS="$REPONAME/lightningd:$VERSION${{ matrix.tag_suffix }}"
if [[ "$PUSHLATEST" == "true" ]]; then
TAGS="$TAGS,$REPONAME/lightningd:latest"
TAGS="$TAGS,$REPONAME/lightningd:latest${{ matrix.tag_suffix }}"
fi
echo "TAGS=$TAGS" >> $GITHUB_ENV

- name: Print GitHub Ref Values
run: |
echo "TARGET: ${{ matrix.target }}"
echo "TAG SUFFIX: ${{ matrix.tag_suffix }}"
echo "GITHUB REF TYPE: ${{ github.ref_type }}"
echo "GITHUB REF NAME: ${{ github.ref_name }}"
echo "EVENT INPUT VERSION: ${{ github.event.inputs.version }}"
Expand All @@ -109,13 +119,16 @@ jobs:
echo "ENV PUSH LATEST: ${{ env.PUSHLATEST }}"
echo "ENV TAGS: ${{ env.TAGS }}"

- name: Build and push Docker image
- name: Build and push Docker tag - ${{ env.TAGS }}
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
target: ${{ matrix.target }}
push: true
platforms: ${{ env.PLATFORMS }}
tags: ${{ env.TAGS }}
build-args: |
VERSION=${{ env.VERSION }}
VERSION=${{ env.VERSION }}
cache-from: type=gha
cache-to: type=gha,mode=max
103 changes: 100 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,71 @@ RUN find /tmp/lightning_install -type f -executable -exec \
awk -F: '/ELF/ {print $1}' | \
xargs -r ${STRIP} --strip-unneeded

FROM base-target AS final
# VLS builder stage (only used by lightningd-vls-signer)
FROM base-builder-${TARGETOS}-${TARGETARCH} AS vls-builder

# First declare the variables that come from parent stages
ARG target_arch
ARG target_arch_gcc
ARG target_arch_dpkg
ARG target_arch_rust
ARG COPTFLAGS

# Then declare the tool variables using the target_arch
ARG AR=${target_arch}-ar
ARG AS=${target_arch}-as
ARG CC=${target_arch}-gcc
ARG CXX=${target_arch}-g++
ARG LD=${target_arch}-ld
ARG STRIP=${target_arch}-strip
ARG TARGET=${target_arch_rust}
ARG RUST_PROFILE=release
ARG VERSION
ARG VLS_VERSION=v0.14.0

# Install cross-compilation toolchain (same as builder stage)
RUN dpkg --add-architecture ${target_arch_dpkg}

RUN apt-get update && \
apt-get install -qq -y --no-install-recommends \
pkg-config:${target_arch_dpkg} \
crossbuild-essential-${target_arch_dpkg} && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

ENV PATH="/root/.cargo/bin:/root/.local/bin:${PATH}"
ENV PKG_CONFIG_PATH=/usr/lib/${target_arch}/pkgconfig
ENV PKG_CONFIG_LIBDIR=/usr/lib/${target_arch}/pkgconfig

WORKDIR /opt

RUN ./install-uv.sh -q
RUN ./install-rust.sh -y -q --profile minimal --component rustfmt --target ${target_arch_rust}

RUN git clone --depth 1 --branch ${VLS_VERSION} https://gitlab.com/lightning-signer/validating-lightning-signer.git
WORKDIR /opt/validating-lightning-signer

RUN mkdir -p .cargo && tee .cargo/config.toml <<EOF

[build]
target = "${target_arch_rust}"
rustflags = ["-C", "target-cpu=generic"]

[target.${target_arch_rust}]
linker = "${CC}"

EOF

RUN cargo build --release --target ${target_arch_rust}

RUN cp -r ./target/${target_arch_rust}/release/ /tmp/vls_install/ \
&& find /tmp/vls_install -type f -executable -exec \
file {} + | \
awk -F: '/ELF/ {print $1}' | \
xargs -r ${STRIP} --strip-unneeded

# Standard Lightning image (without VLS)
FROM base-target AS lightningd

RUN apt-get update && \
apt-get install -qq -y --no-install-recommends \
Expand All @@ -176,8 +240,8 @@ RUN apt-get update && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

COPY --from=downloader /opt/bitcoin/bin/bitcoin-cli /usr/bin/
COPY --from=builder /tmp/lightning_install/ /usr/local/
COPY --from=downloader /opt/bitcoin/bin/bitcoin-cli /usr/bin/
COPY --from=builder /tmp/lightning_install/ /usr/local/

COPY tools/docker-entrypoint.sh /entrypoint.sh

Expand All @@ -189,3 +253,36 @@ ENV LIGHTNINGD_NETWORK=bitcoin
EXPOSE 9735 9835
VOLUME ["/root/.lightning"]
ENTRYPOINT ["/entrypoint.sh"]

# Lightning with VLS Signer
FROM base-target AS lightningd-vls-signer

RUN apt-get update && \
apt-get install -qq -y --no-install-recommends \
inotify-tools \
socat \
jq \
libpq5 \
libsqlite3-0 \
libsodium23 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

COPY --from=downloader /opt/bitcoin/bin/bitcoin-cli /usr/bin/
COPY --from=builder /tmp/lightning_install/ /usr/local/
COPY --from=vls-builder /tmp/vls_install/remote_hsmd_socket /var/lib/vls/bin/

COPY tools/docker-entrypoint.sh /entrypoint.sh

ENV LIGHTNINGD_DATA=/root/.lightning
ENV LIGHTNINGD_RPC_PORT=9835
ENV LIGHTNINGD_PORT=9735
ENV LIGHTNINGD_NETWORK=bitcoin
ENV VLS_ENABLED=true

EXPOSE 9735 9835
VOLUME ["/root/.lightning"]
ENTRYPOINT ["/entrypoint.sh"]

# Default target (for backward compatibility)
FROM lightningd AS final
93 changes: 93 additions & 0 deletions doc/contribute-to-core-lightning/docker-images.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,96 @@ docker exec -it <container-id-from-step2> bash
docker run -it --rm --platform=linux/amd64 --network=host -v '/root/.lightning:/root/.lightning' -v '/root/.bitcoin:/root/.bitcoin' -e LIGHTNINGD_DATA=/root/.lightning elementsproject/lightningd:latest --network=regtest

```

## Replace the `hsmd` subdaemon with VLS `remote_hsmd_socket`:

1. This setup assumes that both `bitcoind` and `vlsd` will be running on your host system.

2. Start your `bitcoind` node on the local machine.

3. Start `vlsd` locally with your prefered configuration. For example:

```shell
export LIGHTNING_VLS_DIR=/root/.lightning
export GREENLIGHT_VERSION="v25.12"
export VLS_CLN_VERSION="v25.12"
export VLS_NETWORK="regtest"
export BITCOIND_RPC_URL="http://user:[email protected]:18443"
export RUST_LOG=info
export RUST_BACKTRACE=1

/home/validating-lightning-signer/target/release/vlsd \
--datadir "$LIGHTNING_VLS_DIR"/.lightning-signer \
--network regtest \
--connect http://127.0.0.1:7701 \
--rpc-server-address 127.0.0.1 \
--rpc-server-port 8000 \
--rpc-user vlsuser \
--rpc-pass vlspassword \
--log-level info
```

4. Finally, run the Core Lightning node:

4.1 Either by utilizing our docker image flavor `elementsproject/lightningd:v25.12-vls` which comes with pre-built `remote_hsmd_socket` binaries.

```shell
docker run -it --rm -d \
--platform=linux/amd64 \
--network=host \
-v '/root/.lightning:/root/.lightning' \
-v '/root/.bitcoin:/root/.bitcoin' \
-e GREENLIGHT_VERSION="v25.12" \
-e VLS_CLN_VERSION="v25.12" \
-e VLS_NETWORK="regtest" \
-e BITCOIND_RPC_URL="http://user:[email protected]:18443" \
-e LIGHTNINGD_NETWORK=regtest \
elementsproject/lightningd:v25.12-vls \
--bitcoin-rpcconnect=0.0.0.0 \
--bitcoin-rpcuser=user \
--bitcoin-rpcpassword=password \
--network=regtest \
--database-upgrade=true \
--bitcoin-datadir=/root/.bitcoin \
--log-level=debug \
--announce-addr=127.0.0.1:19750 \
--bind-addr=localhost:8989 \
--bind-addr=ws:127.0.0.1:5020 \
--bind-addr=0.0.0.0:19750 \
--bitcoin-rpcport=18443 \
--clnrest-port=3020 \
--grpc-port=9740 \
--subdaemon=hsmd:/var/lib/vls/bin/remote_hsmd_socket
```

4.2 Or, by replacing subdaemon `hsmd` with your mounted `remote_hsmd_socket`:

```shell
docker run -it --rm -d \
--platform=linux/amd64 \
--network=host \
-v '/root/.lightning:/root/.lightning' \
-v '/root/.bitcoin:/root/.bitcoin' \
-v '/root/vls/target/release/remote_hsmd_socket:/var/lib/vls/bin/remote_hsmd_socket'
-e GREENLIGHT_VERSION="v25.12" \
-e VLS_CLN_VERSION="v25.12" \
-e VLS_NETWORK="regtest" \
-e BITCOIND_RPC_URL="http://user:[email protected]:18443" \
-e LIGHTNINGD_NETWORK=regtest \
elementsproject/lightningd:v25.12 \
--bitcoin-rpcconnect=0.0.0.0 \
--bitcoin-rpcuser=user \
--bitcoin-rpcpassword=password \
--network=regtest \
--database-upgrade=true \
--bitcoin-datadir=/root/.bitcoin \
--log-level=debug \
--announce-addr=127.0.0.1:19750 \
--bind-addr=localhost:8989 \
--bind-addr=ws:127.0.0.1:5020 \
--bind-addr=0.0.0.0:19750 \
--bitcoin-rpcport=18443 \
--clnrest-port=3020 \
--grpc-port=9740 \
--subdaemon=hsmd:/var/lib/vls/bin/remote_hsmd_socket
```
Loading