From 818215b5708f8f3dfecb73f0dcd8cb0b07afd0c3 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Sat, 22 Jul 2023 01:12:39 -0400 Subject: [PATCH] Correct Dockerfile caching --- deploy/message-queue/Dockerfile | 4 +++- deploy/processor/Dockerfile | 4 +++- deploy/serai/Dockerfile | 23 +++++++++-------------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/deploy/message-queue/Dockerfile b/deploy/message-queue/Dockerfile index 2337ee75..3f9ba815 100644 --- a/deploy/message-queue/Dockerfile +++ b/deploy/message-queue/Dockerfile @@ -19,7 +19,9 @@ WORKDIR /serai RUN apt update && apt install -y clang # Mount the caches and build -RUN --mount=type=cache,target=/root/.cargo/ \ +RUN --mount=type=cache,target=/root/.cargo \ + --mount=type=cache,target=/usr/local/cargo/registry \ + --mount=type=cache,target=/usr/local/cargo/git \ --mount=type=cache,target=/serai/target \ cd message-queue && \ cargo build --release --all-features && \ diff --git a/deploy/processor/Dockerfile b/deploy/processor/Dockerfile index 973ad5f4..d1c87d94 100644 --- a/deploy/processor/Dockerfile +++ b/deploy/processor/Dockerfile @@ -17,7 +17,9 @@ ADD AGPL-3.0 /serai WORKDIR /serai # Mount the caches and build -RUN --mount=type=cache,target=/root/.cargo/ \ +RUN --mount=type=cache,target=/root/.cargo \ + --mount=type=cache,target=/usr/local/cargo/registry \ + --mount=type=cache,target=/usr/local/cargo/git \ --mount=type=cache,target=/serai/target \ cd processor && \ cargo build --release --all-features && \ diff --git a/deploy/serai/Dockerfile b/deploy/serai/Dockerfile index 4dde4e07..467f7b9a 100644 --- a/deploy/serai/Dockerfile +++ b/deploy/serai/Dockerfile @@ -20,31 +20,26 @@ WORKDIR /serai RUN rustup update # Install Solc @ 0.8.16 -RUN --mount=type=cache,target=/root/.cache/ \ - --mount=type=cache,target=/root/.local/ \ +RUN --mount=type=cache,target=/root/.cache \ + --mount=type=cache,target=/root/.local \ --mount=type=cache,target=/root/.solc-select \ pip3 install solc-select==0.2.1 -RUN --mount=type=cache,target=/root/.cache/ \ - --mount=type=cache,target=/root/.local/ \ +RUN --mount=type=cache,target=/root/.cache \ + --mount=type=cache,target=/root/.local \ --mount=type=cache,target=/root/.solc-select \ solc-select install 0.8.16 -RUN --mount=type=cache,target=/root/.cache/ \ - --mount=type=cache,target=/root/.local/ \ +RUN --mount=type=cache,target=/root/.cache \ + --mount=type=cache,target=/root/.local \ --mount=type=cache,target=/root/.solc-select \ solc-select use 0.8.16 # Mount cargo and the Serai cache -RUN --mount=type=cache,target=/root/.local/ \ +RUN --mount=type=cache,target=/root/.local \ --mount=type=cache,target=/root/.solc-select \ - --mount=type=cache,target=/root/.cache/ \ + --mount=type=cache,target=/root/.cache \ --mount=type=cache,target=/usr/local/cargo/git \ --mount=type=cache,target=/usr/local/cargo/registry \ - --mount=type=cache,target=/serai/target/release/build \ - --mount=type=cache,target=/serai/target/release/deps \ - --mount=type=cache,target=/serai/target/release/.fingerprint \ - --mount=type=cache,target=/serai/target/release/incremental \ - --mount=type=cache,target=/serai/target/release/wbuild \ - --mount=type=cache,target=/serai/target/release/lib* \ + --mount=type=cache,target=/serai/target \ cd substrate/node && cargo build --release # Prepare Image