From c6ec7be27b05b4c16a9fe628e08123057ee112be Mon Sep 17 00:00:00 2001 From: Zanie Date: Thu, 18 Jan 2024 20:20:56 -0600 Subject: [PATCH 1/4] Speed up image builds with Docker cache mounts --- Dockerfile | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 16be9504357a..2e3d561448ff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,8 +34,17 @@ RUN rustup target add $(cat rust_target.txt) COPY crates crates COPY ./Cargo.toml Cargo.toml COPY ./Cargo.lock Cargo.lock -RUN cargo zigbuild --bin puffin --target $(cat rust_target.txt) --release -RUN cp target/$(cat rust_target.txt)/release/puffin /puffin + +# Build with mounted cache +RUN --mount=type=cache,target=./target \ + --mount=type=cache,target=/usr/local/cargo/git \ + --mount=type=cache,target=/usr/local/cargo/registry \ + cargo zigbuild --bin puffin --target $(cat rust_target.txt) --release + +# Copy binary into normal layer +RUN --mount=type=cache,target=./target \ + cp ./target/$(cat rust_target.txt)/release/puffin /puffin + # TODO(konsti): Optimize binary size, with a version that also works when cross compiling # RUN strip --strip-all /puffin From a601d41494412d5cb6024f80e002e9efbe926f3d Mon Sep 17 00:00:00 2001 From: Zanie Date: Thu, 18 Jan 2024 20:23:33 -0600 Subject: [PATCH 2/4] Run Docker builds on pull requests that change the Dockerfile --- .github/workflows/build-docker.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 517b88648b07..d704001e182c 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -19,6 +19,8 @@ on: - pyproject.toml # And when we change this workflow itself... - .github/workflows/build-docker.yml + # Or when we change the Dockerfile! + - Dockerfile jobs: docker-publish: From d881642a32a34a960848e6a8ac06a2e651164fa3 Mon Sep 17 00:00:00 2001 From: Zanie Date: Thu, 18 Jan 2024 20:57:08 -0600 Subject: [PATCH 3/4] Empty commit From d297b1ef8aa4a8f76abff2bb334b367a5c520150 Mon Sep 17 00:00:00 2001 From: Zanie Date: Thu, 18 Jan 2024 21:06:03 -0600 Subject: [PATCH 4/4] Commit with an edit in `puffin-traits` --- crates/puffin-traits/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/puffin-traits/src/lib.rs b/crates/puffin-traits/src/lib.rs index ebef0c95fa12..b17dabcaa460 100644 --- a/crates/puffin-traits/src/lib.rs +++ b/crates/puffin-traits/src/lib.rs @@ -150,7 +150,7 @@ pub enum BuildKind { impl Display for BuildKind { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { match self { - BuildKind::Wheel => f.write_str("wheel"), + BuildKind::Wheel => f.write_str("REVERT ME"), BuildKind::Editable => f.write_str("editable"), } }