Update Dockerfile and build-release.sh to PR7214

This commit is contained in:
nicolas.dorier 2024-05-23 08:34:11 +09:00 committed by Alex Myers
parent 738ddc66cc
commit 369c0c1391
2 changed files with 18 additions and 21 deletions

View file

@ -66,6 +66,7 @@ RUN apt-get update -qq && \
gettext \ gettext \
git \ git \
gnupg \ gnupg \
jq \
libpq-dev \ libpq-dev \
libtool \ libtool \
libffi-dev \ libffi-dev \
@ -98,8 +99,8 @@ COPY . /tmp/lightning
RUN git clone --recursive /tmp/lightning . && \ RUN git clone --recursive /tmp/lightning . && \
git checkout $(git --work-tree=/tmp/lightning --git-dir=/tmp/lightning/.git rev-parse HEAD) git checkout $(git --work-tree=/tmp/lightning --git-dir=/tmp/lightning/.git rev-parse HEAD)
# Do not build clnrest here, since it's python, we can't cross compile it. # Do not build python plugins (clnrest & wss-proxy) here, python doesn't support cross compilation.
RUN sed -i '/^clnrest/d' pyproject.toml && \ RUN sed -i '/^clnrest\|^wss-proxy/d' pyproject.toml && \
/root/.local/bin/poetry export -o requirements.txt --without-hashes /root/.local/bin/poetry export -o requirements.txt --without-hashes
RUN pip3 install -r requirements.txt && pip3 cache purge RUN pip3 install -r requirements.txt && pip3 cache purge
WORKDIR / WORKDIR /
@ -197,7 +198,7 @@ RUN ./configure --prefix=/tmp/lightning_install --enable-static && \
make && \ make && \
/root/.local/bin/poetry run make install /root/.local/bin/poetry run make install
# We need to build cln-rest on the target's arch because python doesn't support cross build # We need to build python plugins on the target's arch because python doesn't support cross build
FROM ${BASE_DISTRO} as builder-python FROM ${BASE_DISTRO} as builder-python
RUN apt-get update -qq && \ RUN apt-get update -qq && \
apt-get install -qq -y --no-install-recommends \ apt-get install -qq -y --no-install-recommends \
@ -223,8 +224,11 @@ RUN rustup toolchain install stable --component rustfmt --allow-downgrade
WORKDIR /opt/lightningd WORKDIR /opt/lightningd
COPY plugins/clnrest/requirements.txt plugins/clnrest/requirements.txt COPY plugins/clnrest/requirements.txt plugins/clnrest/requirements.txt
COPY plugins/wss-proxy/requirements.txt plugins/wss-proxy/requirements.txt
ENV PYTHON_VERSION=3 ENV PYTHON_VERSION=3
RUN pip3 install -r plugins/clnrest/requirements.txt && pip3 cache purge RUN pip3 install -r plugins/clnrest/requirements.txt && \
pip3 install -r plugins/wss-proxy/requirements.txt && \
pip3 cache purge
FROM ${BASE_DISTRO} as final FROM ${BASE_DISTRO} as final

View file

@ -20,7 +20,6 @@ fi
FORCE_UNCLEAN=false FORCE_UNCLEAN=false
VERIFY_RELEASE=false VERIFY_RELEASE=false
DOCKER_PUSH=false
ALL_TARGETS="bin-Fedora-28-amd64 bin-Ubuntu docker sign" ALL_TARGETS="bin-Fedora-28-amd64 bin-Ubuntu docker sign"
# ALL_TARGETS="bin-Fedora-28-amd64 bin-Ubuntu tarball deb docker sign" # ALL_TARGETS="bin-Fedora-28-amd64 bin-Ubuntu tarball deb docker sign"
@ -39,9 +38,6 @@ for arg; do
--verify) --verify)
VERIFY_RELEASE=true VERIFY_RELEASE=true
;; ;;
--push)
DOCKER_PUSH=true
;;
--help) --help)
echo "Usage: [--force-version=<ver>] [--force-unclean] [--force-mtime=YYYY-MM-DD] [--verify] [TARGETS]" echo "Usage: [--force-version=<ver>] [--force-unclean] [--force-mtime=YYYY-MM-DD] [--verify] [TARGETS]"
echo Known targets: "$ALL_TARGETS" echo Known targets: "$ALL_TARGETS"
@ -49,8 +45,8 @@ for arg; do
echo "Example: tools/build-release.sh --force-version=v23.05 --force-unclean --force-mtime=2023-05-01 bin-Fedora-28-amd64 bin-Ubuntu sign" echo "Example: tools/build-release.sh --force-version=v23.05 --force-unclean --force-mtime=2023-05-01 bin-Fedora-28-amd64 bin-Ubuntu sign"
echo "Example: tools/build-release.sh --verify" 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 --force-version=v23.05 --force-unclean --force-mtime=2023-05-01 --verify"
echo "Example: tools/build-release.sh --push docker" echo "Example: tools/build-release.sh docker"
echo "Example: tools/build-release.sh --force-version=v23.05 --force-unclean --force-mtime=2023-05-01 --push docker" echo "Example: tools/build-release.sh --force-version=v23.05 --force-unclean --force-mtime=2023-05-01 docker"
exit 0 exit 0
;; ;;
-*) -*)
@ -176,21 +172,18 @@ if [ -z "${TARGETS##* docker *}" ]; then
echo "Building Docker Images" echo "Building Docker Images"
DOCKER_USER="elementsproject" DOCKER_USER="elementsproject"
echo "Creating a multi-platform image tagged as $VERSION" echo "Creating a multi-platform image tagged as $VERSION"
DOCKER_OPTS="--platform linux/amd64,linux/arm64,linux/arm/v7" DOCKER_OPTS="--platform linux/amd64,linux/arm64,linux/arm/v7 --push"
$DOCKER_PUSH && DOCKER_OPTS="$DOCKER_OPTS --push"
DOCKER_OPTS="$DOCKER_OPTS -t $DOCKER_USER/lightningd:$VERSION" DOCKER_OPTS="$DOCKER_OPTS -t $DOCKER_USER/lightningd:$VERSION"
DOCKER_OPTS="$DOCKER_OPTS -t $DOCKER_USER/lightningd:latest" DOCKER_OPTS="$DOCKER_OPTS -t $DOCKER_USER/lightningd:latest"
echo "Docker Options: $DOCKER_OPTS"
#docker buildx create --use if sudo docker buildx ls | grep -q 'cln-builder'; then
sudo docker buildx use cln-builder
# shellcheck disable=SC2086
docker buildx build $DOCKER_OPTS .
if $DOCKER_PUSH; then
echo "Pushed a multi-platform image tagged as latest"
else else
echo "Docker Images Built. Ready to Upload on Dockerhub." sudo docker buildx create --name=cln-builder --use
fi fi
# shellcheck disable=SC2086
sudo docker buildx build $DOCKER_OPTS .
echo "Pushed a multi-platform image tagged as latest"
fi fi
if [ -z "${TARGETS##* sign *}" ]; then if [ -z "${TARGETS##* sign *}" ]; then