From 41eb81447c3b5189d5341c70b0215fe3533c0f99 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Sat, 16 Dec 2023 13:50:15 +0100 Subject: [PATCH] docker: Use `git clone` as the build basis for reprobuilds We used to use the zip archive, which comes with some baggage, especially for some of the submodule-based dependencies. Using `git clone` ensures that we have a clean snapshot, based on the latest commit, and we can skip some of the wildcard operations on zip files. Changelog-None --- contrib/reprobuild/Dockerfile.focal | 13 +++++++------ contrib/reprobuild/Dockerfile.jammy | 13 +++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/contrib/reprobuild/Dockerfile.focal b/contrib/reprobuild/Dockerfile.focal index 0dd8b1d2c5d1..a02e552ceb73 100644 --- a/contrib/reprobuild/Dockerfile.focal +++ b/contrib/reprobuild/Dockerfile.focal @@ -58,11 +58,12 @@ RUN cd /tmp/ && \ RUN mkdir /build WORKDIR /build -CMD poetry export -o requirements.txt --without-hashes \ +# We mount the repo into `/repo` and then we take a snapshot of it +# first by cloning it. This ensures we're not including any +# uncommitted changes in the working directory on the host. Notice +# that we no longer take the zipfile. +CMD git clone /repo . \ + && poetry export -o requirements.txt --without-hashes \ && pip install -r requirements.txt \ - && mkdir -p /repro \ - && cd /repro \ - && unzip /build/release/*.zip \ - && cd clightning* \ && tools/repro-build.sh \ - && cp *.xz /build/release/ + && cp *.xz /repo/release/ diff --git a/contrib/reprobuild/Dockerfile.jammy b/contrib/reprobuild/Dockerfile.jammy index 024067b2d979..6c97db546e4d 100644 --- a/contrib/reprobuild/Dockerfile.jammy +++ b/contrib/reprobuild/Dockerfile.jammy @@ -59,11 +59,12 @@ RUN cd /tmp/ && \ RUN mkdir /build WORKDIR /build -CMD poetry export -o requirements.txt --without-hashes \ +# We mount the repo into `/repo` and then we take a snapshot of it +# first by cloning it. This ensures we're not including any +# uncommitted changes in the working directory on the host. Notice +# that we no longer take the zipfile. +CMD git clone /repo . \ + && poetry export -o requirements.txt --without-hashes \ && pip install -r requirements.txt \ - && mkdir -p /repro \ - && cd /repro \ - && unzip /build/release/*.zip \ - && cd clightning* \ && tools/repro-build.sh \ - && cp *.xz /build/release/ + && cp *.xz /repo/release/