Correct Dockerfile caching

This commit is contained in:
Luke Parker 2023-07-22 01:12:39 -04:00
parent 79943c3a6c
commit 818215b570
No known key found for this signature in database
3 changed files with 15 additions and 16 deletions

View file

@ -19,7 +19,9 @@ WORKDIR /serai
RUN apt update && apt install -y clang RUN apt update && apt install -y clang
# Mount the caches and build # 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 \ --mount=type=cache,target=/serai/target \
cd message-queue && \ cd message-queue && \
cargo build --release --all-features && \ cargo build --release --all-features && \

View file

@ -17,7 +17,9 @@ ADD AGPL-3.0 /serai
WORKDIR /serai WORKDIR /serai
# Mount the caches and build # 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 \ --mount=type=cache,target=/serai/target \
cd processor && \ cd processor && \
cargo build --release --all-features && \ cargo build --release --all-features && \

View file

@ -20,31 +20,26 @@ WORKDIR /serai
RUN rustup update RUN rustup update
# Install Solc @ 0.8.16 # Install Solc @ 0.8.16
RUN --mount=type=cache,target=/root/.cache/ \ RUN --mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/root/.local/ \ --mount=type=cache,target=/root/.local \
--mount=type=cache,target=/root/.solc-select \ --mount=type=cache,target=/root/.solc-select \
pip3 install solc-select==0.2.1 pip3 install solc-select==0.2.1
RUN --mount=type=cache,target=/root/.cache/ \ RUN --mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/root/.local/ \ --mount=type=cache,target=/root/.local \
--mount=type=cache,target=/root/.solc-select \ --mount=type=cache,target=/root/.solc-select \
solc-select install 0.8.16 solc-select install 0.8.16
RUN --mount=type=cache,target=/root/.cache/ \ RUN --mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/root/.local/ \ --mount=type=cache,target=/root/.local \
--mount=type=cache,target=/root/.solc-select \ --mount=type=cache,target=/root/.solc-select \
solc-select use 0.8.16 solc-select use 0.8.16
# Mount cargo and the Serai cache # 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/.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/git \
--mount=type=cache,target=/usr/local/cargo/registry \ --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/serai/target/release/build \ --mount=type=cache,target=/serai/target \
--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* \
cd substrate/node && cargo build --release cd substrate/node && cargo build --release
# Prepare Image # Prepare Image