From 1454bd86d5e8cf9c2ed935be1b7889132fff851b Mon Sep 17 00:00:00 2001 From: Antoine Poinsot Date: Thu, 30 Mar 2023 15:07:40 +0200 Subject: [PATCH] docker: adapt the reproducible builds to the new gui folder structure For simplicity get rid of the vendoring within the image itself. We can always reintroduce it later should we need it. --- contrib/reproducible/docker/docker-build.sh | 17 +++++++++++++++-- contrib/reproducible/docker/macos.Dockerfile | 17 ++--------------- contrib/reproducible/docker/windows.Dockerfile | 12 ++---------- 3 files changed, 19 insertions(+), 27 deletions(-) diff --git a/contrib/reproducible/docker/docker-build.sh b/contrib/reproducible/docker/docker-build.sh index c97656f1..6c86dc5b 100755 --- a/contrib/reproducible/docker/docker-build.sh +++ b/contrib/reproducible/docker/docker-build.sh @@ -11,10 +11,16 @@ docker build . -t liana_cross_win -f contrib/reproducible/docker/windows.Dockerf docker run --rm -ti \ -v "$TARGET_DIR/gui":/liana/target \ -v "$PWD/contrib/reproducible/docker":/liana/docker \ + -v "$PWD/gui/Cargo.toml":/liana/Cargo.toml \ + -v "$PWD/gui/Cargo.lock":/liana/Cargo.lock \ -v "$PWD/gui/src":/liana/src \ - -v "$PWD/gui/static":/liana/static \ + -v "$PWD/gui/ui/Cargo.toml":/liana/ui/Cargo.toml \ + -v "$PWD/gui/ui/Cargo.lock":/liana/ui/Cargo.lock \ + -v "$PWD/gui/ui/src":/liana/ui/src \ + -v "$PWD/gui/ui/static":/liana/ui/static \ liana_cross_win + # Sanity check the given MacOS SDK is the expected one. if ! $(echo "28d352f8c14a43d9b8a082ac6338dc173cb153f964c6e8fb6ba389e5be528bd0 $(basename $XCODE_PATH)" | sha256sum -c --status); then echo "No or invalid Xcode SDK found. Need an Xcode_12.2.xip. You can configure the path using \$XCODE_PATH."; @@ -27,9 +33,16 @@ docker run --rm -ti \ -v "$TARGET_DIR":/liana/target \ -v "$TARGET_DIR/gui":/liana/gui/target \ -v "$PWD/contrib/reproducible/docker":/liana/docker \ + -v "$PWD/Cargo.toml":/liana/Cargo.toml \ + -v "$PWD/Cargo.lock":/liana/Cargo.lock \ -v "$PWD/src":/liana/src \ + -v "$PWD/gui/Cargo.toml":/liana/gui/Cargo.toml \ + -v "$PWD/gui/Cargo.lock":/liana/gui/Cargo.lock \ -v "$PWD/gui/src":/liana/gui/src \ - -v "$PWD/gui/static":/liana/gui/static \ + -v "$PWD/gui/ui/Cargo.toml":/liana/gui/ui/Cargo.toml \ + -v "$PWD/gui/ui/Cargo.lock":/liana/gui/ui/Cargo.lock \ + -v "$PWD/gui/ui/src":/liana/gui/ui/src \ + -v "$PWD/gui/ui/static":/liana/gui/ui/static \ -v "$XCODE_PATH":/liana/Xcode_12.2.xip \ liana_cross_mac diff --git a/contrib/reproducible/docker/macos.Dockerfile b/contrib/reproducible/docker/macos.Dockerfile index 5113c2b9..86987068 100644 --- a/contrib/reproducible/docker/macos.Dockerfile +++ b/contrib/reproducible/docker/macos.Dockerfile @@ -33,21 +33,8 @@ RUN curl -O "https://static.rust-lang.org/dist/rust-1.65.0-x86_64-unknown-linux- tar -xzf rust-1.65.0-x86_64-apple-darwin.tar.gz && \ rm -r *.tar.gz -# Copy the Cargo files for both the daemon and the GUI to vendor the dependencies. -COPY Cargo.toml Cargo.lock /liana/ -COPY gui/Cargo.toml gui/Cargo.lock /liana/gui/ - -# We cache the dependencies sources in the image to avoid re-indexing everything from scratch -# at every run. It was useful when debugging the build, it could be removed eventually if we -# think the tradeoff vs the image size isn't worth it anymore. -RUN /liana/rust-1.65.0-x86_64-unknown-linux-gnu/cargo/bin/cargo vendor && \ - cd gui && \ - /liana/rust-1.65.0-x86_64-unknown-linux-gnu/cargo/bin/cargo vendor && \ - cd .. - -# Cargo configuration for using the vendored dependencies during the builds. -COPY contrib/reproducible/docker/cargo_config.toml /liana/.cargo/cargo_config.toml -COPY contrib/reproducible/docker/cargo_config.toml /liana/gui/.cargo/cargo_config.toml +# NOTE: we were previously caching dependencies here (through `cargo vendor`). It's a tradeoff between the image size +# and not needing internet access when running the image to build the software. # For some reason, we can't just set the RUSTFLAGS environment variable to add `-L` for compiling dependencies. # This doesn't work: RUSTFLAGS="-L/liana/rust-1.65.0-x86_64-apple-darwin/rust-std-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/" diff --git a/contrib/reproducible/docker/windows.Dockerfile b/contrib/reproducible/docker/windows.Dockerfile index 1ea7336a..0374f8f8 100644 --- a/contrib/reproducible/docker/windows.Dockerfile +++ b/contrib/reproducible/docker/windows.Dockerfile @@ -19,16 +19,8 @@ RUN curl -O "https://static.rust-lang.org/dist/rust-1.65.0-x86_64-unknown-linux- tar -xzf rust-1.65.0-x86_64-pc-windows-gnu.tar.gz && \ rm -r *.tar.gz -# Copy the Cargo files to vendor the dependencies. -COPY gui/Cargo.toml gui/Cargo.lock /liana/ - -# We cache the dependencies sources in the image to avoid re-indexing everything from scratch -# at every run. It was useful when debugging the build, it could be removed eventually if we -# think the tradeoff vs the image size wasn't worth it anymore. -RUN /liana/rust-1.65.0-x86_64-unknown-linux-gnu/cargo/bin/cargo vendor - -# Cargo configuration for using the vendored dependencies during the build. -COPY contrib/reproducible/docker/cargo_config.toml /liana/.cargo/cargo_config.toml +# NOTE: we were previously caching dependencies here (through `cargo vendor`). It's a tradeoff between the image size +# and not needing internet access when running the image to build the software. # For some reason, we can't just set the RUSTFLAGS environment variable to add `-L` for compiling dependencies. # This doesn't work: RUSTFLAGS="-L /liana/rust-1.65.0-x86_64-pc-windows-gnu/rust-std-x86_64-pc-windows-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/ -L /liana/rust-1.65.0-x86_64-unknown-linux-gnu/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/"