From 70a12a865123c19290c55e4332a1a5375e501153 Mon Sep 17 00:00:00 2001 From: stone-w4tch3r <100294019+stone-w4tch3r@users.noreply.github.com> Date: Mon, 29 Jul 2024 05:23:16 +0500 Subject: [PATCH] try fix disappearing cache --- Dockerfile | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index b660cef..ebf1076 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,10 +15,16 @@ RUN --mount=type=cache,target=/var/cache/apt \ COPY . /pake WORKDIR /pake/src-tauri -# Build cargo packages +# Build cargo packages and store cache RUN --mount=type=cache,target=/usr/local/cargo/registry \ cargo fetch && \ - cargo build --release + cargo build --release && \ + mkdir -p /cargo-cache && \ + cp -R /usr/local/cargo/registry /cargo-cache/ && \ + cp -R /usr/local/cargo/git /cargo-cache/ + +# Ensure the content of /cargo-cache && clean unnecessary files +RUN ls -la /cargo-cache/registry && ls -la /cargo-cache/git && rm -rfd /cargo-cache/registry/cache # Main build stage FROM rust:1.80-slim AS builder @@ -44,8 +50,8 @@ RUN --mount=type=cache,target=/root/.npm \ npm install COPY --from=cargo-builder /pake/src-tauri /usr/lib/node_modules/pake-cli/src-tauri -COPY --from=cargo-builder /usr/local/cargo/git /usr/local/cargo/git -COPY --from=cargo-builder /usr/local/cargo/registry/cache /usr/local/cargo/registry/cache +COPY --from=cargo-builder /cargo-cache/git /usr/local/cargo/git +COPY --from=cargo-builder /cargo-cache/registry /usr/local/cargo/registry WORKDIR /app ENTRYPOINT ["pake"]