From f40b6da457794fc60854172065fdcb5b3b218780 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Mon, 25 Apr 2022 18:23:18 +0200 Subject: [PATCH] repro: Update repro dockerfiles and instructions Switching to poetry, and deprecating python 3.6, made things a bit more tricky. Sadly we'll not be able to build jammy, as its support is missing in the tag tarball, but it'll be there for the next release. --- contrib/reprobuild/Dockerfile.bionic | 64 +++++++++++++++++----------- contrib/reprobuild/Dockerfile.focal | 9 ++-- contrib/reprobuild/Dockerfile.jammy | 47 ++++++++++++++++++++ doc/REPRODUCIBLE.md | 28 ++++++------ 4 files changed, 105 insertions(+), 43 deletions(-) create mode 100644 contrib/reprobuild/Dockerfile.jammy diff --git a/contrib/reprobuild/Dockerfile.bionic b/contrib/reprobuild/Dockerfile.bionic index d0d13715c..f01857481 100644 --- a/contrib/reprobuild/Dockerfile.bionic +++ b/contrib/reprobuild/Dockerfile.bionic @@ -7,36 +7,52 @@ RUN sed -i '/updates/d' /etc/apt/sources.list && \ sed -i '/security/d' /etc/apt/sources.list RUN apt-get update \ - && apt-get install -y --no-install-recommends \ + && apt-get install -y --no-install-recommends \ ca-certificates \ - sudo \ - build-essential \ - libsodium23 \ - python3-setuptools \ - libpq-dev \ - git \ - file \ - autoconf \ - debianutils \ - gettext \ - zip \ - unzip \ - wget + sudo \ + build-essential \ + libsodium23 \ + libpq-dev \ + git \ + file \ + autoconf \ + debianutils \ + gettext \ + zip \ + unzip \ + wget + +# Need to fetch a python version that is >= 3.7 since that's the +# lowest version supported by pyln. This is just temporary until we +# drop support for ubuntu 18.04 +ENV PATH=/root/.pyenv/shims:/root/.pyenv/bin:$PATH +RUN git clone https://github.com/pyenv/pyenv.git /root/.pyenv \ + && apt-get install -y --no-install-recommends \ + libbz2-dev \ + libffi-dev \ + libreadline-dev \ + libsqlite3-dev \ + libssl-dev \ + zlib1g-dev \ + && pyenv install 3.7.0 \ + && pyenv global 3.7.0 RUN wget https://bootstrap.pypa.io/get-pip.py -O /tmp/get-pip.py && python3 /tmp/get-pip.py \ && rm /tmp/get-pip.py \ - && pip install mrkd mako + && pip install poetry RUN mkdir /build WORKDIR /build CMD git clone /repo /build \ - && tools/build-release.sh zipfile \ - && mkdir -p /repro \ - && cd /repro \ - && unzip /build/release/*.zip \ - && cd clightning* \ - && tools/repro-build.sh \ - && cp *.xz /build/release/* /repo/release/ \ - && cd /repo/release \ - && sha256sum * + && poetry export -o requirements.txt --without-hashes \ + && pip install -r requirements.txt\ + && tools/build-release.sh zipfile \ + && mkdir -p /repro \ + && cd /repro \ + && unzip /build/release/*.zip \ + && cd clightning* \ + && tools/repro-build.sh \ + && cp *.xz /build/release/* /repo/release/ \ + && cd /repo/release \ + && sha256sum * diff --git a/contrib/reprobuild/Dockerfile.focal b/contrib/reprobuild/Dockerfile.focal index a58e44a5f..774295a42 100644 --- a/contrib/reprobuild/Dockerfile.focal +++ b/contrib/reprobuild/Dockerfile.focal @@ -26,19 +26,22 @@ RUN apt-get update \ zip RUN wget https://bootstrap.pypa.io/get-pip.py -O /tmp/get-pip.py && python3 /tmp/get-pip.py \ - && rm /tmp/get-pip.py \ - && pip install mrkd mako + && rm /tmp/get-pip.py \ + && pip install poetry RUN mkdir /build WORKDIR /build CMD git clone /repo /build \ + && poetry export -o requirements.txt --without-hashes \ + && pip install -r requirements.txt \ && tools/build-release.sh zipfile \ && mkdir -p /repro \ && cd /repro \ && unzip /build/release/*.zip \ && cd clightning* \ - && tools/repro-build.sh \ + && tools/repro-build.sh \ + && mkdir -p /repo/release \ && cp *.xz /build/release/* /repo/release/ \ && cd /repo/release/ \ && sha256sum * diff --git a/contrib/reprobuild/Dockerfile.jammy b/contrib/reprobuild/Dockerfile.jammy new file mode 100644 index 000000000..a935938a4 --- /dev/null +++ b/contrib/reprobuild/Dockerfile.jammy @@ -0,0 +1,47 @@ +FROM jammy + +ENV TZ=UTC +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +RUN sed -i '/updates/d' /etc/apt/sources.list && \ + sed -i '/security/d' /etc/apt/sources.list + +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + autoconf \ + build-essential \ + ca-certificates \ + file \ + gettext \ + git \ + libgmp-dev \ + libpq-dev \ + libsodium23 \ + libtool \ + m4 \ + python3-setuptools \ + sudo \ + unzip \ + wget \ + zip + +RUN wget https://bootstrap.pypa.io/get-pip.py -O /tmp/get-pip.py && python3 /tmp/get-pip.py \ + && rm /tmp/get-pip.py \ + && pip install poetry + +RUN mkdir /build +WORKDIR /build + +CMD git clone /repo /build \ + && poetry export -o requirements.txt --without-hashes \ + && pip install -r requirements.txt \ + && tools/build-release.sh zipfile \ + && mkdir -p /repro \ + && cd /repro \ + && unzip /build/release/*.zip \ + && cd clightning* \ + && tools/repro-build.sh \ + && mkdir -p /repo/release \ + && cp *.xz /build/release/* /repo/release/ \ + && cd /repo/release/ \ + && sha256sum * diff --git a/doc/REPRODUCIBLE.md b/doc/REPRODUCIBLE.md index 55b94af16..1d2daf9b1 100644 --- a/doc/REPRODUCIBLE.md +++ b/doc/REPRODUCIBLE.md @@ -66,30 +66,26 @@ latter means that if we disable the `updates` and `security` repositories for packages (wrongly updated packages depending on the versions not available in the non-updated repos). -The following will create that base image: - -```bash -sudo debootstrap bionic bionic -sudo tar -C bionic -c . | sudo docker import - bionic -``` - -`bionic` in this case is the codename for Ubuntu 18.04 LTS. The following -table lists the codenames of distributions that we currently support: +The following table lists the codenames of distributions that we +currently support: | Distribution Version | Codename | |----------------------|----------| | Ubuntu 18.04 | bionic | | Ubuntu 20.04 | focal | +| Ubuntu 22.04 | jammy | -Notice that you migh not have `debootstrap` manifests for versions newer than -your host OS. If one of the `debootstrap` command above complains about a -script not existing you might need to run `debootstrap` in a docker container -itself: +Depending on your host OS release you migh not have `debootstrap` +manifests for versions newer than your host OS. Due to this we run the +`debootstrap` commands in a container of the latest version itself: ```bash -sudo docker run --rm -v $(pwd):/build ubuntu:20.04 \ - bash -c "apt update && apt-get install -y debootstrap && debootstrap focal /build/focal" -sudo tar -C focal -c . | sudo docker import - focal +for v in bionic focal jammy; do + echo "Building base image for $v" + sudo docker run --rm -v $(pwd):/build ubuntu:22.04 \ + bash -c "apt-get update && apt-get install -y debootstrap && debootstrap $v /build/$v" + sudo tar -C $v -c . | sudo docker import - $v +done ``` Verify that the image corresponds to our expectation and is runnable: