Refactor Dockerfile, Add TODOs
all these changelogs only apply to the Docker image. Changelog-Added: added verification of GPG keys for the bitcoin and litecoin tarballs. Changelog-Fixed: fixed compilation on all target architectures; each had their own bugs (poetry, missing packages...). Changelog-Fixed: fixed cargo cross compilation. it was mistakenly using QEMU before. Changelog-Fixed: fixed CPU compatibility bug described in issue 8456 Changelog-Changed: improve build time by 8.8x Changelog-Changed: improve image size by 2.07x more detailed changelog can be found on the PR: https://github.com/ElementsProject/lightning/pull/8429
This commit is contained in:
committed by
ShahanaFarooqui
parent
9fe8f3ab2e
commit
13c5db51a9
@@ -1,3 +1,6 @@
|
||||
Dockerfile
|
||||
contrib/docker/Dockerfile.*
|
||||
target
|
||||
config.vars
|
||||
release/
|
||||
.venv/
|
||||
353
Dockerfile
353
Dockerfile
@@ -1,271 +1,200 @@
|
||||
# This Dockerfile is used by buildx to build ARM64, AMD64, and ARM32 Docker images from an AMD64 host.
|
||||
# To speed up the build process, we are cross-compiling rather than relying on QEMU.
|
||||
# There are four main stages:
|
||||
# * downloader: Downloads specific binaries needed for core lightning for each architecture.
|
||||
# * builder: Cross-compiles for each architecture.
|
||||
# * final: Creates the runtime image.
|
||||
# syntax=docker/dockerfile:1.7-labs
|
||||
|
||||
ARG DEFAULT_TARGETPLATFORM="linux/amd64"
|
||||
ARG BASE_DISTRO="debian:bookworm-slim"
|
||||
FROM --platform=${BUILDPLATFORM} debian:bookworm-slim AS base-host
|
||||
|
||||
FROM --platform=$BUILDPLATFORM ${BASE_DISTRO} AS base-downloader
|
||||
RUN set -ex \
|
||||
&& apt-get update \
|
||||
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr wget qemu-user-static binfmt-support
|
||||
SHELL ["/bin/bash", "-euo", "pipefail", "-c"]
|
||||
|
||||
FROM base-downloader AS base-downloader-linux-amd64
|
||||
ENV TARBALL_ARCH_FINAL=x86_64-linux-gnu
|
||||
FROM --platform=${TARGETPLATFORM} debian:bookworm-slim AS base-target
|
||||
|
||||
FROM base-downloader AS base-downloader-linux-arm64
|
||||
ENV TARBALL_ARCH_FINAL=aarch64-linux-gnu
|
||||
SHELL ["/bin/bash", "-euo", "pipefail", "-c"]
|
||||
|
||||
FROM base-downloader AS base-downloader-linux-arm
|
||||
ENV TARBALL_ARCH_FINAL=arm-linux-gnueabihf
|
||||
FROM base-host AS downloader-linux-amd64
|
||||
|
||||
FROM base-downloader-${TARGETOS}-${TARGETARCH} AS downloader
|
||||
ARG target_arch=x86_64-linux-gnu
|
||||
|
||||
RUN set -ex \
|
||||
&& apt-get update \
|
||||
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr wget
|
||||
FROM base-host AS downloader-linux-arm64
|
||||
|
||||
WORKDIR /opt
|
||||
ARG target_arch=aarch64-linux-gnu
|
||||
|
||||
FROM base-host AS downloader-linux-arm
|
||||
|
||||
ENV BITCOIN_VERSION=27.1
|
||||
ENV BITCOIN_TARBALL bitcoin-${BITCOIN_VERSION}-${TARBALL_ARCH_FINAL}.tar.gz
|
||||
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-$BITCOIN_VERSION/$BITCOIN_TARBALL
|
||||
ENV BITCOIN_ASC_URL https://bitcoincore.org/bin/bitcoin-core-$BITCOIN_VERSION/SHA256SUMS
|
||||
ARG target_arch=arm-linux-gnueabihf
|
||||
|
||||
RUN mkdir /opt/bitcoin && cd /opt/bitcoin \
|
||||
&& wget -qO $BITCOIN_TARBALL "$BITCOIN_URL" \
|
||||
&& wget -qO bitcoin "$BITCOIN_ASC_URL" \
|
||||
&& grep $BITCOIN_TARBALL bitcoin | tee SHA256SUMS \
|
||||
&& sha256sum -c SHA256SUMS \
|
||||
&& BD=bitcoin-$BITCOIN_VERSION/bin \
|
||||
&& tar -xzvf $BITCOIN_TARBALL $BD/ --strip-components=1 \
|
||||
&& rm $BITCOIN_TARBALL
|
||||
FROM downloader-${TARGETOS}-${TARGETARCH} AS downloader
|
||||
|
||||
ENV LITECOIN_VERSION 0.16.3
|
||||
ENV LITECOIN_URL https://download.litecoin.org/litecoin-${LITECOIN_VERSION}/linux/litecoin-${LITECOIN_VERSION}-${TARBALL_ARCH_FINAL}.tar.gz
|
||||
|
||||
# install litecoin binaries
|
||||
RUN mkdir /opt/litecoin && cd /opt/litecoin \
|
||||
&& wget -qO litecoin.tar.gz "$LITECOIN_URL" \
|
||||
&& tar -xzvf litecoin.tar.gz litecoin-$LITECOIN_VERSION/bin/litecoin-cli --strip-components=1 --exclude=*-qt \
|
||||
&& rm litecoin.tar.gz
|
||||
|
||||
FROM --platform=${DEFAULT_TARGETPLATFORM} ${BASE_DISTRO} AS base-builder
|
||||
RUN apt-get update -qq && \
|
||||
RUN apt-get update && \
|
||||
apt-get install -qq -y --no-install-recommends \
|
||||
gnupg
|
||||
|
||||
ARG BITCOIN_VERSION=27.1
|
||||
ARG BITCOIN_URL=https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}
|
||||
ARG BITCOIN_TARBALL=bitcoin-${BITCOIN_VERSION}-${target_arch}.tar.gz
|
||||
|
||||
WORKDIR /opt/bitcoin
|
||||
|
||||
ADD ${BITCOIN_URL}/${BITCOIN_TARBALL} .
|
||||
ADD ${BITCOIN_URL}/SHA256SUMS .
|
||||
ADD ${BITCOIN_URL}/SHA256SUMS.asc .
|
||||
COPY contrib/keys/bitcoin/ gpg/
|
||||
|
||||
RUN gpg --quiet --import gpg/* && \
|
||||
gpg --verify SHA256SUMS.asc SHA256SUMS && \
|
||||
sha256sum -c SHA256SUMS --ignore-missing
|
||||
|
||||
RUN tar xzf ${BITCOIN_TARBALL} --strip-components=1
|
||||
|
||||
ARG LITECOIN_VERSION=0.16.3
|
||||
ARG LITECOIN_BASE_URL=https://download.litecoin.org/litecoin-${LITECOIN_VERSION}
|
||||
ARG LITECOIN_URL=${LITECOIN_BASE_URL}/linux
|
||||
ARG LITECOIN_TARBALL=litecoin-${LITECOIN_VERSION}-${target_arch}.tar.gz
|
||||
|
||||
WORKDIR /opt/litecoin
|
||||
|
||||
ADD ${LITECOIN_URL}/${LITECOIN_TARBALL} .
|
||||
ADD ${LITECOIN_URL}/${LITECOIN_TARBALL}.asc .
|
||||
ADD ${LITECOIN_BASE_URL}/SHA256SUMS.asc .
|
||||
COPY contrib/keys/litecoin/ gpg/
|
||||
|
||||
RUN gpg --quiet --import gpg/* && \
|
||||
gpg --verify SHA256SUMS.asc && \
|
||||
gpg --verify ${LITECOIN_TARBALL}.asc ${LITECOIN_TARBALL} && \
|
||||
sha256sum -c SHA256SUMS.asc --ignore-missing
|
||||
|
||||
RUN tar xzf ${LITECOIN_TARBALL} --strip-components=1
|
||||
|
||||
FROM base-host AS base-builder
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -qq -y --no-install-recommends \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
wget \
|
||||
git \
|
||||
autoconf \
|
||||
automake \
|
||||
bison \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
curl \
|
||||
dirmngr \
|
||||
flex \
|
||||
gettext \
|
||||
git \
|
||||
gnupg \
|
||||
jq \
|
||||
libicu-dev \
|
||||
libtool \
|
||||
libffi-dev \
|
||||
pkg-config \
|
||||
libssl-dev \
|
||||
protobuf-compiler \
|
||||
python3 \
|
||||
python3-dev \
|
||||
python3-mako \
|
||||
python3-pip \
|
||||
python3-venv \
|
||||
python3-setuptools \
|
||||
libev-dev \
|
||||
libevent-dev \
|
||||
qemu-user-static \
|
||||
wget \
|
||||
unzip \
|
||||
tclsh
|
||||
gettext \
|
||||
protobuf-compiler
|
||||
|
||||
ENV PATH="/root/.local/bin:$PATH" \
|
||||
PYTHON_VERSION=3
|
||||
WORKDIR /opt
|
||||
|
||||
RUN wget -q https://zlib.net/fossils/zlib-1.2.13.tar.gz -O zlib.tar.gz && \
|
||||
wget -q https://www.sqlite.org/2019/sqlite-src-3290000.zip -O sqlite.zip && \
|
||||
wget -q https://ftp.postgresql.org/pub/source/v17.1/postgresql-17.1.tar.gz -O postgres.tar.gz
|
||||
ADD --chmod=750 https://astral.sh/uv/install.sh install-uv.sh
|
||||
ADD --chmod=750 https://sh.rustup.rs install-rust.sh
|
||||
|
||||
WORKDIR /opt/lightningd
|
||||
COPY . /tmp/lightning
|
||||
RUN git clone --recursive /tmp/lightning . && \
|
||||
git checkout $(git --work-tree=/tmp/lightning --git-dir=/tmp/lightning/.git rev-parse HEAD)
|
||||
|
||||
RUN wget -qO- https://astral.sh/uv/install.sh | sh && \
|
||||
uv sync --all-extras --all-groups
|
||||
|
||||
WORKDIR /
|
||||
COPY --exclude=.git/ . .
|
||||
|
||||
FROM base-builder AS base-builder-linux-amd64
|
||||
|
||||
ENV POSTGRES_CONFIG="--without-readline" \
|
||||
PG_CONFIG=/usr/local/pgsql/bin/pg_config
|
||||
ARG target_arch=x86_64-linux-gnu
|
||||
ARG target_arch_gcc=x86-64-linux-gnu
|
||||
ARG target_arch_dpkg=amd64
|
||||
ARG target_arch_rust=x86_64-unknown-linux-gnu
|
||||
ARG COPTFLAGS="-O2 -march=x86-64"
|
||||
|
||||
FROM base-builder AS base-builder-linux-arm64
|
||||
ENV target_host=aarch64-linux-gnu \
|
||||
target_host_rust=aarch64-unknown-linux-gnu \
|
||||
target_host_qemu=qemu-aarch64-static
|
||||
|
||||
RUN apt-get install -qq -y --no-install-recommends \
|
||||
libc6-arm64-cross \
|
||||
gcc-${target_host} \
|
||||
g++-${target_host}
|
||||
|
||||
ENV AR=${target_host}-ar \
|
||||
AS=${target_host}-as \
|
||||
CC=${target_host}-gcc \
|
||||
CXX=${target_host}-g++ \
|
||||
LD=${target_host}-ld \
|
||||
STRIP=${target_host}-strip \
|
||||
QEMU_LD_PREFIX=/usr/${target_host} \
|
||||
HOST=${target_host} \
|
||||
TARGET=${target_host_rust} \
|
||||
RUSTUP_INSTALL_OPTS="--target ${target_host_rust} --default-host ${target_host_rust}" \
|
||||
PKG_CONFIG_PATH="/usr/${target_host}/lib/pkgconfig"
|
||||
|
||||
ENV ZLIB_CONFIG="--prefix=${QEMU_LD_PREFIX}" \
|
||||
SQLITE_CONFIG="--host=${target_host} --prefix=${QEMU_LD_PREFIX}" \
|
||||
POSTGRES_CONFIG="--without-readline --prefix=${QEMU_LD_PREFIX}" \
|
||||
PG_CONFIG="${QEMU_LD_PREFIX}/bin/pg_config"
|
||||
ARG target_arch=aarch64-linux-gnu
|
||||
ARG target_arch_gcc=aarch64-linux-gnu
|
||||
ARG target_arch_dpkg=arm64
|
||||
ARG target_arch_rust=aarch64-unknown-linux-gnu
|
||||
ARG COPTFLAGS="-O2 -march=armv8-a"
|
||||
|
||||
FROM base-builder AS base-builder-linux-arm
|
||||
|
||||
ENV target_host=arm-linux-gnueabihf \
|
||||
target_host_rust=armv7-unknown-linux-gnueabihf \
|
||||
target_host_qemu=qemu-arm-static
|
||||
|
||||
RUN apt-get install -qq -y --no-install-recommends \
|
||||
libc6-armhf-cross \
|
||||
gcc-${target_host} \
|
||||
g++-${target_host}
|
||||
|
||||
ENV AR=${target_host}-ar \
|
||||
AS=${target_host}-as \
|
||||
CC=${target_host}-gcc \
|
||||
CXX=${target_host}-g++ \
|
||||
LD=${target_host}-ld \
|
||||
STRIP=${target_host}-strip \
|
||||
QEMU_LD_PREFIX=/usr/${target_host} \
|
||||
HOST=${target_host} \
|
||||
TARGET=${target_host_rust} \
|
||||
RUSTUP_INSTALL_OPTS="--target ${target_host_rust} --default-host ${target_host_rust}" \
|
||||
PKG_CONFIG_PATH="/usr/${target_host}/lib/pkgconfig"
|
||||
|
||||
ENV ZLIB_CONFIG="--prefix=${QEMU_LD_PREFIX}" \
|
||||
SQLITE_CONFIG="--host=${target_host} --prefix=${QEMU_LD_PREFIX}" \
|
||||
POSTGRES_CONFIG="--without-readline --prefix=${QEMU_LD_PREFIX}" \
|
||||
PG_CONFIG="${QEMU_LD_PREFIX}/bin/pg_config"
|
||||
ARG target_arch=arm-linux-gnueabihf
|
||||
ARG target_arch_gcc=arm-linux-gnueabihf
|
||||
ARG target_arch_dpkg=armhf
|
||||
ARG target_arch_rust=armv7-unknown-linux-gnueabihf
|
||||
#TODO: bug with -O2 in armv7, see https://github.com/ElementsProject/lightning/issues/8501
|
||||
ARG COPTFLAGS="-O1 -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard"
|
||||
|
||||
FROM base-builder-${TARGETOS}-${TARGETARCH} AS builder
|
||||
|
||||
ENV LIGHTNINGD_VERSION=master
|
||||
|
||||
RUN mkdir zlib && tar xvf zlib.tar.gz -C zlib --strip-components=1 \
|
||||
&& cd zlib \
|
||||
&& ./configure ${ZLIB_CONFIG} \
|
||||
&& make \
|
||||
&& make install && cd .. && \
|
||||
rm zlib.tar.gz && \
|
||||
rm -rf zlib
|
||||
RUN dpkg --add-architecture ${target_arch_dpkg}
|
||||
|
||||
RUN unzip sqlite.zip \
|
||||
&& cd sqlite-* \
|
||||
&& ./configure --enable-static --disable-readline --disable-threadsafe --disable-load-extension ${SQLITE_CONFIG} \
|
||||
&& make \
|
||||
&& make install && cd .. && rm sqlite.zip && rm -rf sqlite-*
|
||||
#TODO: python3-dev needs QEMU for post install scripts. find a workaround to not use QEMU
|
||||
RUN apt-get update && \
|
||||
apt-get install -qq -y --no-install-recommends \
|
||||
pkg-config:${target_arch_dpkg} \
|
||||
libffi-dev:${target_arch_dpkg} \
|
||||
python3-dev:${target_arch_dpkg} \
|
||||
libicu-dev:${target_arch_dpkg} \
|
||||
zlib1g-dev:${target_arch_dpkg} \
|
||||
libsqlite3-dev:${target_arch_dpkg} \
|
||||
libpq-dev:${target_arch_dpkg} \
|
||||
crossbuild-essential-${target_arch_dpkg}
|
||||
|
||||
RUN mkdir postgres && tar xvf postgres.tar.gz -C postgres --strip-components=1 \
|
||||
&& cd postgres \
|
||||
&& ./configure ${POSTGRES_CONFIG} \
|
||||
&& cd src/include \
|
||||
&& make install \
|
||||
&& cd ../interfaces/libpq \
|
||||
&& make install \
|
||||
&& cd ../../bin/pg_config \
|
||||
&& make install \
|
||||
&& cd ../../../../ && \
|
||||
rm postgres.tar.gz && \
|
||||
rm -rf postgres && \
|
||||
ldconfig "$(${PG_CONFIG} --libdir)"
|
||||
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
|
||||
|
||||
# Save libpq to a specific location to copy it into the final image.
|
||||
RUN mkdir /var/libpq && cp -a "$(${PG_CONFIG} --libdir)"/libpq.* /var/libpq
|
||||
#TODO: set all the following cargo config options via env variables (https://doc.rust-lang.org/cargo/reference/environment-variables.html)
|
||||
RUN mkdir -p .cargo && tee .cargo/config.toml <<EOF
|
||||
|
||||
ENV RUST_PROFILE=release \
|
||||
PATH="/root/.cargo/bin:/root/.local/bin:$PATH"
|
||||
ENV UV_CACHE_DIR=/tmp/uv-cache
|
||||
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
|
||||
ENV CARGO_NET_GIT_FETCH_WITH_CLI_ALWAYS=true
|
||||
[build]
|
||||
target = "${target_arch_rust}"
|
||||
rustflags = ["-C", "target-cpu=generic"]
|
||||
|
||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y ${RUSTUP_INSTALL_OPTS}
|
||||
RUN rustup toolchain install stable --component rustfmt --allow-downgrade
|
||||
[target.${target_arch_rust}]
|
||||
linker = "${CC}"
|
||||
|
||||
COPY --from=downloader /usr/bin/${target_host_qemu} /usr/bin/${target_host_qemu}
|
||||
WORKDIR /opt/lightningd
|
||||
EOF
|
||||
|
||||
# If cross-compiling, need to tell it to cargo.
|
||||
RUN ( ! [ -n "${target_host}" ] ) || \
|
||||
(mkdir -p .cargo && echo "[target.${target_host_rust}]\nlinker = \"${target_host}-gcc\"" > .cargo/config)
|
||||
WORKDIR /opt
|
||||
|
||||
# Weird errors with cargo for cln-grpc on arm7 https://github.com/ElementsProject/lightning/issues/6596
|
||||
RUN ( ! [ "${target_host}" = "arm-linux-gnueabihf" ] ) || \
|
||||
(sed -i '/documentation = "https:\/\/docs.rs\/cln-grpc"/a include = ["**\/*.*"]' cln-grpc/Cargo.toml)
|
||||
RUN ./install-uv.sh -q
|
||||
RUN ./install-rust.sh -y -q --profile minimal --component rustfmt --target ${target_arch_rust}
|
||||
|
||||
# Ensure that git differences are removed before making bineries, to avoid `-modded` suffix
|
||||
RUN git reset --hard HEAD
|
||||
RUN ./configure --prefix=/tmp/lightning_install --enable-static && uv run make install
|
||||
|
||||
WORKDIR /opt/lightningd
|
||||
RUN echo 'RUSTUP_INSTALL_OPTS="${RUSTUP_INSTALL_OPTS}"' > /tmp/rustup_install_opts.txt
|
||||
|
||||
# Setup ENV $RUSTUP_INSTALL_OPTS for this stage
|
||||
RUN export $(cat /tmp/rustup_install_opts.txt)
|
||||
ENV PATH="/root/.cargo/bin:/root/.venvs/cln/bin:$PATH"
|
||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y ${RUSTUP_INSTALL_OPTS}
|
||||
ENV PATH="/root/.cargo/bin:/root/.local/bin:${PATH}"
|
||||
|
||||
WORKDIR /opt/lightningd
|
||||
|
||||
FROM ${BASE_DISTRO} AS final
|
||||
#TODO: find a way to avoid copying the .git/ directory (it always invalidates the cache)
|
||||
COPY .git/ .git/
|
||||
RUN git submodule update --init --recursive --jobs $(nproc) --depth 1
|
||||
|
||||
RUN ./configure --prefix=/tmp/lightning_install --enable-static --disable-compat --disable-valgrind
|
||||
RUN uv run make install-program -j$(nproc)
|
||||
|
||||
RUN find /tmp/lightning_install -type f -executable -exec \
|
||||
file {} + | \
|
||||
awk -F: '/ELF/ {print $1}' | \
|
||||
xargs -r ${STRIP} --strip-unneeded
|
||||
|
||||
FROM base-target AS final
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
tini \
|
||||
socat \
|
||||
inotify-tools \
|
||||
jq \
|
||||
python3 && \
|
||||
apt-get install -qq -y --no-install-recommends \
|
||||
inotify-tools \
|
||||
socat \
|
||||
jq \
|
||||
libpq5 && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV LIGHTNINGD_DATA=/root/.lightning \
|
||||
LIGHTNINGD_RPC_PORT=9835 \
|
||||
LIGHTNINGD_PORT=9735 \
|
||||
LIGHTNINGD_NETWORK=bitcoin
|
||||
COPY --from=downloader /opt/bitcoin/bin/bitcoin-cli /usr/bin/
|
||||
COPY --from=downloader /opt/litecoin/bin/litecoin-cli /usr/bin/
|
||||
COPY --from=builder /tmp/lightning_install/ /usr/local/
|
||||
|
||||
RUN mkdir $LIGHTNINGD_DATA && \
|
||||
touch $LIGHTNINGD_DATA/config
|
||||
VOLUME [ "/root/.lightning" ]
|
||||
COPY tools/docker-entrypoint.sh /entrypoint.sh
|
||||
|
||||
# Take libpq directly from builder.
|
||||
RUN mkdir /var/libpq && mkdir -p /usr/local/pgsql/lib
|
||||
RUN --mount=type=bind,from=builder,source=/var/libpq,target=/var/libpq,rw \
|
||||
cp -a /var/libpq/libpq.* /usr/local/pgsql/lib && \
|
||||
echo "/usr/local/pgsql/lib" > /etc/ld.so.conf.d/libpq.conf && \
|
||||
ldconfig
|
||||
|
||||
COPY --from=builder /tmp/lightning_install/ /usr/local/
|
||||
COPY --from=downloader /opt/bitcoin/bin /usr/bin
|
||||
COPY --from=downloader /opt/litecoin/bin /usr/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
|
||||
|
||||
EXPOSE 9735 9835
|
||||
ENTRYPOINT [ "/usr/bin/tini", "-g", "--", "./entrypoint.sh" ]
|
||||
VOLUME ["/root/.lightning"]
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
8
Makefile
8
Makefile
@@ -345,6 +345,14 @@ endif
|
||||
fi
|
||||
|
||||
RUST_PROFILE ?= debug
|
||||
|
||||
# Cargo places cross compiled packages in a different directory, using the target triple
|
||||
ifeq ($(TARGET),)
|
||||
RUST_TARGET_DIR = target/$(RUST_PROFILE)
|
||||
else
|
||||
RUST_TARGET_DIR = target/$(TARGET)/$(RUST_PROFILE)
|
||||
endif
|
||||
|
||||
ifneq ($(RUST_PROFILE),debug)
|
||||
CARGO_OPTS := --profile=$(RUST_PROFILE) --locked --quiet
|
||||
else
|
||||
|
||||
BIN
contrib/keys/bitcoin/0xb10c.gpg
Normal file
BIN
contrib/keys/bitcoin/0xb10c.gpg
Normal file
Binary file not shown.
BIN
contrib/keys/bitcoin/CoinForensics.gpg
Normal file
BIN
contrib/keys/bitcoin/CoinForensics.gpg
Normal file
Binary file not shown.
BIN
contrib/keys/bitcoin/Emzy.gpg
Normal file
BIN
contrib/keys/bitcoin/Emzy.gpg
Normal file
Binary file not shown.
BIN
contrib/keys/bitcoin/Sjors.gpg
Normal file
BIN
contrib/keys/bitcoin/Sjors.gpg
Normal file
Binary file not shown.
BIN
contrib/keys/bitcoin/TheCharlatan.gpg
Normal file
BIN
contrib/keys/bitcoin/TheCharlatan.gpg
Normal file
Binary file not shown.
BIN
contrib/keys/bitcoin/achow101.gpg
Normal file
BIN
contrib/keys/bitcoin/achow101.gpg
Normal file
Binary file not shown.
BIN
contrib/keys/bitcoin/benthecarman.gpg
Normal file
BIN
contrib/keys/bitcoin/benthecarman.gpg
Normal file
Binary file not shown.
BIN
contrib/keys/bitcoin/cfields.gpg
Normal file
BIN
contrib/keys/bitcoin/cfields.gpg
Normal file
Binary file not shown.
BIN
contrib/keys/bitcoin/darosior.gpg
Normal file
BIN
contrib/keys/bitcoin/darosior.gpg
Normal file
Binary file not shown.
BIN
contrib/keys/bitcoin/davidgumberg.gpg
Normal file
BIN
contrib/keys/bitcoin/davidgumberg.gpg
Normal file
Binary file not shown.
BIN
contrib/keys/bitcoin/dunxen.gpg
Normal file
BIN
contrib/keys/bitcoin/dunxen.gpg
Normal file
Binary file not shown.
BIN
contrib/keys/bitcoin/fanquake.gpg
Normal file
BIN
contrib/keys/bitcoin/fanquake.gpg
Normal file
Binary file not shown.
BIN
contrib/keys/bitcoin/glozow.gpg
Normal file
BIN
contrib/keys/bitcoin/glozow.gpg
Normal file
Binary file not shown.
BIN
contrib/keys/bitcoin/guggero.gpg
Normal file
BIN
contrib/keys/bitcoin/guggero.gpg
Normal file
Binary file not shown.
BIN
contrib/keys/bitcoin/hebasto.gpg
Normal file
BIN
contrib/keys/bitcoin/hebasto.gpg
Normal file
Binary file not shown.
BIN
contrib/keys/bitcoin/ismaelsadeeq.gpg
Normal file
BIN
contrib/keys/bitcoin/ismaelsadeeq.gpg
Normal file
Binary file not shown.
BIN
contrib/keys/bitcoin/jackielove4u.gpg
Normal file
BIN
contrib/keys/bitcoin/jackielove4u.gpg
Normal file
Binary file not shown.
BIN
contrib/keys/bitcoin/josibake.gpg
Normal file
BIN
contrib/keys/bitcoin/josibake.gpg
Normal file
Binary file not shown.
BIN
contrib/keys/bitcoin/kvaciral.gpg
Normal file
BIN
contrib/keys/bitcoin/kvaciral.gpg
Normal file
Binary file not shown.
BIN
contrib/keys/bitcoin/laanwj.gpg
Normal file
BIN
contrib/keys/bitcoin/laanwj.gpg
Normal file
Binary file not shown.
BIN
contrib/keys/bitcoin/luke-jr.gpg
Normal file
BIN
contrib/keys/bitcoin/luke-jr.gpg
Normal file
Binary file not shown.
BIN
contrib/keys/bitcoin/m3dwards.gpg
Normal file
BIN
contrib/keys/bitcoin/m3dwards.gpg
Normal file
Binary file not shown.
BIN
contrib/keys/bitcoin/pinheadmz.gpg
Normal file
BIN
contrib/keys/bitcoin/pinheadmz.gpg
Normal file
Binary file not shown.
BIN
contrib/keys/bitcoin/satsie.gpg
Normal file
BIN
contrib/keys/bitcoin/satsie.gpg
Normal file
Binary file not shown.
BIN
contrib/keys/bitcoin/sipa.gpg
Normal file
BIN
contrib/keys/bitcoin/sipa.gpg
Normal file
Binary file not shown.
BIN
contrib/keys/bitcoin/sipsorcery.gpg
Normal file
BIN
contrib/keys/bitcoin/sipsorcery.gpg
Normal file
Binary file not shown.
BIN
contrib/keys/bitcoin/svanstaa.gpg
Normal file
BIN
contrib/keys/bitcoin/svanstaa.gpg
Normal file
Binary file not shown.
BIN
contrib/keys/bitcoin/tapcrafter.gpg
Normal file
BIN
contrib/keys/bitcoin/tapcrafter.gpg
Normal file
Binary file not shown.
BIN
contrib/keys/bitcoin/theStack.gpg
Normal file
BIN
contrib/keys/bitcoin/theStack.gpg
Normal file
Binary file not shown.
BIN
contrib/keys/bitcoin/vertiond.gpg
Normal file
BIN
contrib/keys/bitcoin/vertiond.gpg
Normal file
Binary file not shown.
BIN
contrib/keys/bitcoin/willcl-ark.gpg
Normal file
BIN
contrib/keys/bitcoin/willcl-ark.gpg
Normal file
Binary file not shown.
BIN
contrib/keys/bitcoin/willyko.gpg
Normal file
BIN
contrib/keys/bitcoin/willyko.gpg
Normal file
Binary file not shown.
BIN
contrib/keys/litecoin/davidburkett.gpg
Normal file
BIN
contrib/keys/litecoin/davidburkett.gpg
Normal file
Binary file not shown.
@@ -131,33 +131,4 @@ docker exec -it <container-id-from-step2> bash
|
||||
```shell
|
||||
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
|
||||
|
||||
```
|
||||
|
||||
## Using CLI for CLN Node Running in the Docker Container
|
||||
|
||||
### From Host (Local CLI)
|
||||
|
||||
Use your local lightning-cli (if installed), ensuring that `lightning-dir` is configured with the local directory that is mounted to the container's `root/.lightning`.
|
||||
|
||||
```shell
|
||||
sudo lightning-cli --regtest --lightning-dir=/root/.lightning getinfo
|
||||
```
|
||||
|
||||
### Inside Docker Container
|
||||
1. Get the container ID for the image `elementsproject/lightningd:latest`:
|
||||
|
||||
```shell
|
||||
docker container ps
|
||||
```
|
||||
|
||||
2. Run a new command in the running `lightningd` container:
|
||||
|
||||
```shell
|
||||
docker exec -it <container-id-from-step1> bash
|
||||
```
|
||||
|
||||
3. Use the container's `lightning-cli`:
|
||||
|
||||
```shell
|
||||
lightning-cli --regtest getinfo
|
||||
```
|
||||
```
|
||||
@@ -41,6 +41,12 @@ To install for a specific version, for example, 24.05:
|
||||
docker pull elementsproject/lightningd:v24.05
|
||||
```
|
||||
|
||||
To run the Docker container:
|
||||
|
||||
```shell
|
||||
docker run --rm --init -v /path/on/host/lightning-data:/root/.lightning -p 9735:9735 -p 9835:9835 lightningd
|
||||
```
|
||||
|
||||
See all of the docker images for Core Lightning on [Docker Hub](https://hub.docker.com/r/elementsproject/lightningd/tags).
|
||||
|
||||
# Third-party apps
|
||||
|
||||
@@ -140,17 +140,17 @@ $(shell test -d plugins/wss-proxy && $(RM) -r plugins/wss-proxy || true)
|
||||
ifneq ($(RUST),0)
|
||||
# Builtin plugins must be in this plugins dir to work when we're executed
|
||||
# *without* make install.
|
||||
plugins/cln-grpc: target/${RUST_PROFILE}/cln-grpc
|
||||
plugins/cln-grpc: $(RUST_TARGET_DIR)/cln-grpc
|
||||
@cp $< $@
|
||||
plugins/clnrest: target/${RUST_PROFILE}/clnrest
|
||||
plugins/clnrest: $(RUST_TARGET_DIR)/clnrest
|
||||
@cp $< $@
|
||||
plugins/cln-lsps-client: target/${RUST_PROFILE}/cln-lsps-client
|
||||
plugins/cln-lsps-client: $(RUST_TARGET_DIR)/cln-lsps-client
|
||||
@cp $< $@
|
||||
plugins/cln-lsps-service: target/${RUST_PROFILE}/cln-lsps-service
|
||||
plugins/cln-lsps-service: $(RUST_TARGET_DIR)/cln-lsps-service
|
||||
@cp $< $@
|
||||
plugins/wss-proxy: target/${RUST_PROFILE}/wss-proxy
|
||||
plugins/wss-proxy: $(RUST_TARGET_DIR)/wss-proxy
|
||||
@cp $< $@
|
||||
plugins/cln-bip353: target/${RUST_PROFILE}/cln-bip353
|
||||
plugins/cln-bip353: $(RUST_TARGET_DIR)/cln-bip353
|
||||
@cp $< $@
|
||||
|
||||
PLUGINS += plugins/cln-grpc plugins/clnrest plugins/cln-lsps-client plugins/cln-lsps-service plugins/wss-proxy plugins/cln-bip353
|
||||
@@ -293,14 +293,14 @@ PLUGIN_BASES := $(PLUGINS:plugins/%=%) $(PY_PLUGINS:plugins/%=%)
|
||||
plugins/list_of_builtin_plugins_gen.h: plugins/Makefile Makefile config.vars
|
||||
@$(call VERBOSE,GEN $@,echo "static const char *list_of_builtin_plugins[] = { $(PLUGIN_BASES:%=\"%\",) NULL };" > $@)
|
||||
|
||||
target/${RUST_PROFILE}/examples/cln-subscribe-wildcard: ${CLN_PLUGIN_SRC} plugins/examples/cln-subscribe-wildcard.rs
|
||||
$(RUST_TARGET_DIR)/examples/cln-subscribe-wildcard: ${CLN_PLUGIN_SRC} plugins/examples/cln-subscribe-wildcard.rs
|
||||
cargo build ${CARGO_OPTS} --example cln-subscribe-wildcard
|
||||
|
||||
CLN_PLUGIN_EXAMPLES := \
|
||||
target/${RUST_PROFILE}/examples/cln-plugin-startup \
|
||||
target/${RUST_PROFILE}/examples/cln-plugin-reentrant \
|
||||
target/${RUST_PROFILE}/examples/cln-rpc-getinfo \
|
||||
target/${RUST_PROFILE}/examples/cln-subscribe-wildcard
|
||||
$(RUST_TARGET_DIR)/examples/cln-plugin-startup \
|
||||
$(RUST_TARGET_DIR)/examples/cln-plugin-reentrant \
|
||||
$(RUST_TARGET_DIR)/examples/cln-rpc-getinfo \
|
||||
$(RUST_TARGET_DIR)/examples/cln-subscribe-wildcard
|
||||
|
||||
CLN_PLUGIN_SRC = $(shell find plugins/src -name "*.rs")
|
||||
CLN_GRPC_PLUGIN_SRC = $(shell find plugins/grpc-plugin/src -name "*.rs")
|
||||
@@ -309,17 +309,17 @@ CLN_LSPS_PLUGIN_SRC = $(shell find plugins/lsps-plugin/src -name "*.rs")
|
||||
CLN_WSS_PROXY_PLUGIN_SRC = $(shell find plugins/wss-proxy-plugin/src -name "*.rs")
|
||||
CLN_BIP353_PLUGIN_SRC = $(shell find plugins/bip353-plugin/src -name "*.rs")
|
||||
|
||||
target/${RUST_PROFILE}/cln-grpc: ${CLN_PLUGIN_SRC} ${CLN_GRPC_PLUGIN_SRC} $(MSGGEN_GENALL) $(MSGGEN_GEN_ALL)
|
||||
$(RUST_TARGET_DIR)/cln-grpc: ${CLN_PLUGIN_SRC} ${CLN_GRPC_PLUGIN_SRC} $(MSGGEN_GENALL) $(MSGGEN_GEN_ALL)
|
||||
cargo build ${CARGO_OPTS} --bin cln-grpc
|
||||
target/${RUST_PROFILE}/clnrest: ${CLN_REST_PLUGIN_SRC}
|
||||
$(RUST_TARGET_DIR)/clnrest: ${CLN_REST_PLUGIN_SRC}
|
||||
cargo build ${CARGO_OPTS} --bin clnrest
|
||||
target/${RUST_PROFILE}/cln-lsps-client: ${CLN_LSPS_PLUGIN_SRC}
|
||||
$(RUST_TARGET_DIR)/cln-lsps-client: ${CLN_LSPS_PLUGIN_SRC}
|
||||
cargo build ${CARGO_OPTS} --bin cln-lsps-client
|
||||
target/${RUST_PROFILE}/cln-lsps-service: ${CLN_LSPS_PLUGIN_SRC}
|
||||
$(RUST_TARGET_DIR)/cln-lsps-service: ${CLN_LSPS_PLUGIN_SRC}
|
||||
cargo build ${CARGO_OPTS} --bin cln-lsps-service
|
||||
target/${RUST_PROFILE}/wss-proxy: ${CLN_WSS_PROXY_PLUGIN_SRC}
|
||||
$(RUST_TARGET_DIR)/wss-proxy: ${CLN_WSS_PROXY_PLUGIN_SRC}
|
||||
cargo build ${CARGO_OPTS} --bin wss-proxy
|
||||
target/${RUST_PROFILE}/cln-bip353: ${CLN_BIP353_PLUGIN_SRC}
|
||||
$(RUST_TARGET_DIR)/cln-bip353: ${CLN_BIP353_PLUGIN_SRC}
|
||||
cargo build ${CARGO_OPTS} --bin cln-bip353
|
||||
|
||||
ifneq ($(RUST),0)
|
||||
|
||||
@@ -34,7 +34,7 @@ ALL_TARGETS="bin-Fedora bin-Ubuntu docker sign"
|
||||
for arg; do
|
||||
case "$arg" in
|
||||
--force-version=*)
|
||||
FORCE_VERSION=${arg#*=}
|
||||
FORCE_VERSION=${arg#*=}
|
||||
;;
|
||||
--force-unclean)
|
||||
FORCE_UNCLEAN=true
|
||||
@@ -54,10 +54,10 @@ for arg; do
|
||||
--help)
|
||||
echo "Usage: [--force-version=<ver>] [--force-unclean] [--force-mtime=YYYY-MM-DD] [--verify] [TARGETS]"
|
||||
echo Known targets: "$ALL_TARGETS"
|
||||
echo "Example: tools/build-release.sh"
|
||||
echo "Example: tools/build-release.sh --force-version=v23.05 --force-unclean --force-mtime=2023-05-01 bin-Fedora bin-Ubuntu sign"
|
||||
echo "Example: tools/build-release.sh --verify"
|
||||
echo "Example: tools/build-release.sh --force-version=v23.05 --force-unclean --force-mtime=2023-05-01 --verify"
|
||||
echo "Example: tools/build-release.sh"
|
||||
echo "Example: tools/build-release.sh --force-version=v23.05 --force-unclean --force-mtime=2023-05-01 bin-Fedora bin-Ubuntu sign"
|
||||
echo "Example: tools/build-release.sh --verify"
|
||||
echo "Example: tools/build-release.sh --force-version=v23.05 --force-unclean --force-mtime=2023-05-01 --verify"
|
||||
echo "Example: tools/build-release.sh docker"
|
||||
echo "Example: tools/build-release.sh --force-version=v23.05 --force-unclean --force-mtime=2023-05-01 docker"
|
||||
exit 0
|
||||
@@ -91,9 +91,9 @@ fi
|
||||
case "$VERSION" in
|
||||
v*) ;;
|
||||
*)
|
||||
echo "Version must begin with v! Not $VERSION" >&2
|
||||
exit 1
|
||||
;;
|
||||
echo "Version must begin with v! Not $VERSION" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# `status --porcelain -u no` suppressed modified! Bug reported...
|
||||
@@ -119,7 +119,7 @@ if [ "$VERIFY_RELEASE" = "true" ]; then
|
||||
ALL_TARGETS="bin-Ubuntu"
|
||||
else
|
||||
echo "Unable to verify. File SHA256SUMS-$VERSION or SHA256SUMS-$VERSION.asc not found in the root."
|
||||
exit 1
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -212,7 +212,7 @@ if [ -z "${TARGETS##* docker *}" ]; then
|
||||
DOCKER_OPTS="--push --platform linux/amd64,linux/arm64,linux/arm/v7"
|
||||
DOCKER_OPTS="$DOCKER_OPTS -t $DOCKER_USER/lightningd:$VERSION"
|
||||
DOCKER_OPTS="$DOCKER_OPTS -t $DOCKER_USER/lightningd:latest"
|
||||
DOCKER_OPTS="$DOCKER_OPTS --cache-to=type=local,dest=/tmp/docker-cache --cache-from=type=local,src=/tmp/docker-cache"
|
||||
DOCKER_OPTS="$DOCKER_OPTS --cache-to=type=local,dest=/tmp/docker-cache --cache-from=type=local,src=/tmp/docker-cache"
|
||||
echo "Docker Options: $DOCKER_OPTS"
|
||||
if $SUDO docker buildx ls | grep -q 'cln-builder'; then
|
||||
$SUDO docker buildx use cln-builder
|
||||
@@ -259,7 +259,7 @@ if [ "$VERIFY_RELEASE" = "true" ]; then
|
||||
echo "SHA256SUMS are Identical"
|
||||
else
|
||||
echo "Error: SHA256SUMS do NOT Match"
|
||||
exit 1
|
||||
exit 1
|
||||
fi
|
||||
# verify release captain signature
|
||||
gpg --verify "../SHA256SUMS-$VERSION.asc"
|
||||
|
||||
Reference in New Issue
Block a user