Revert "drop mount type cache"
This reverts commit dcfc51c2f5e78ec1768a36d0a4472948ebf73bb5.
This commit is contained in:
parent
0218a9d5c9
commit
667c43cca1
45
Dockerfile
45
Dockerfile
@ -31,17 +31,25 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
|||||||
;
|
;
|
||||||
|
|
||||||
# install rustup
|
# install rustup
|
||||||
RUN set -eux -o pipefail; \
|
RUN --mount=type=cache,target=/root/.cargo/git \
|
||||||
|
--mount=type=cache,target=/root/.cargo/registry \
|
||||||
|
set -eux -o pipefail; \
|
||||||
\
|
\
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none --profile=minimal
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none --profile=minimal
|
||||||
|
|
||||||
# run a cargo command to install our desired version of rust
|
# run a cargo command to install our desired version of rust
|
||||||
# it is expected to exit code 101 since no Cargo.toml exists
|
# it is expected to exit code 101 since no Cargo.toml exists
|
||||||
COPY rust-toolchain.toml ./
|
COPY rust-toolchain.toml ./
|
||||||
RUN cargo check || [ "$?" -eq 101 ]
|
RUN --mount=type=cache,target=/root/.cargo/git \
|
||||||
|
--mount=type=cache,target=/root/.cargo/registry \
|
||||||
|
set -eux -o pipefail; \
|
||||||
|
\
|
||||||
|
cargo check || [ "$?" -eq 101 ]
|
||||||
|
|
||||||
# cargo binstall
|
# cargo binstall
|
||||||
RUN set -eux -o pipefail; \
|
RUN --mount=type=cache,target=/root/.cargo/git \
|
||||||
|
--mount=type=cache,target=/root/.cargo/registry \
|
||||||
|
set -eux -o pipefail; \
|
||||||
\
|
\
|
||||||
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh >/tmp/install-binstall.sh; \
|
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh >/tmp/install-binstall.sh; \
|
||||||
bash /tmp/install-binstall.sh; \
|
bash /tmp/install-binstall.sh; \
|
||||||
@ -51,12 +59,18 @@ RUN set -eux -o pipefail; \
|
|||||||
# TODO: i'd like to use binaries for these, but i had trouble with arm and binstall
|
# TODO: i'd like to use binaries for these, but i had trouble with arm and binstall
|
||||||
FROM rust as rust_nextest
|
FROM rust as rust_nextest
|
||||||
|
|
||||||
RUN cargo binstall -y cargo-nextest
|
RUN --mount=type=cache,target=/root/.cargo/git \
|
||||||
|
--mount=type=cache,target=/root/.cargo/registry \
|
||||||
|
set -eux -o pipefail; \
|
||||||
|
\
|
||||||
|
cargo binstall -y cargo-nextest
|
||||||
|
|
||||||
# foundry/anvil are needed to run tests (done its in own FROM so that it can run in parallel)
|
# foundry/anvil are needed to run tests (done its in own FROM so that it can run in parallel)
|
||||||
FROM rust as rust_foundry
|
FROM rust as rust_foundry
|
||||||
|
|
||||||
RUN set -eux -o pipefail; \
|
RUN --mount=type=cache,target=/root/.cargo/git \
|
||||||
|
--mount=type=cache,target=/root/.cargo/registry \
|
||||||
|
set -eux -o pipefail; \
|
||||||
\
|
\
|
||||||
curl -L https://foundry.paradigm.xyz | bash && foundryup
|
curl -L https://foundry.paradigm.xyz | bash && foundryup
|
||||||
|
|
||||||
@ -65,11 +79,12 @@ FROM rust as rust_with_env
|
|||||||
# changing our features doesn't change any of the steps above
|
# changing our features doesn't change any of the steps above
|
||||||
ENV WEB3_PROXY_FEATURES "rdkafka-src"
|
ENV WEB3_PROXY_FEATURES "rdkafka-src"
|
||||||
|
|
||||||
# copy the app
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
# fill the package caches
|
# fill the package caches
|
||||||
RUN set -eux -o pipefail; \
|
RUN --mount=type=bind,source=.,target=/app,rw \
|
||||||
|
--mount=type=cache,target=/root/.cargo/git \
|
||||||
|
--mount=type=cache,target=/root/.cargo/registry \
|
||||||
|
--mount=type=cache,target=/app/target \
|
||||||
|
set -eux -o pipefail; \
|
||||||
\
|
\
|
||||||
[ -e "$(pwd)/payment-contracts/src/contracts/mod.rs" ] || touch "$(pwd)/payment-contracts/build.rs"; \
|
[ -e "$(pwd)/payment-contracts/src/contracts/mod.rs" ] || touch "$(pwd)/payment-contracts/build.rs"; \
|
||||||
cargo \
|
cargo \
|
||||||
@ -83,7 +98,11 @@ COPY --from=rust_foundry /root/.foundry/bin/anvil /root/.foundry/bin/
|
|||||||
COPY --from=rust_nextest /root/.cargo/bin/cargo-nextest* /root/.cargo/bin/
|
COPY --from=rust_nextest /root/.cargo/bin/cargo-nextest* /root/.cargo/bin/
|
||||||
|
|
||||||
# test the application with cargo-nextest
|
# test the application with cargo-nextest
|
||||||
RUN set -eux -o pipefail; \
|
RUN --mount=type=bind,source=.,target=/app,rw \
|
||||||
|
--mount=type=cache,target=/root/.cargo/git \
|
||||||
|
--mount=type=cache,target=/root/.cargo/registry \
|
||||||
|
--mount=type=cache,target=/app/target_test \
|
||||||
|
set -eux -o pipefail; \
|
||||||
\
|
\
|
||||||
export CARGO_TARGET_DIR=target_test; \
|
export CARGO_TARGET_DIR=target_test; \
|
||||||
[ -e "$(pwd)/payment-contracts/src/contracts/mod.rs" ] || touch "$(pwd)/payment-contracts/build.rs"; \
|
[ -e "$(pwd)/payment-contracts/src/contracts/mod.rs" ] || touch "$(pwd)/payment-contracts/build.rs"; \
|
||||||
@ -102,7 +121,11 @@ FROM rust_with_env as build_app
|
|||||||
# build the release application
|
# build the release application
|
||||||
# using a "release" profile (which install does by default) is **very** important
|
# using a "release" profile (which install does by default) is **very** important
|
||||||
# TODO: use the "faster_release" profile which builds with `codegen-units = 1` (but compile is SLOW)
|
# TODO: use the "faster_release" profile which builds with `codegen-units = 1` (but compile is SLOW)
|
||||||
RUN set -eux -o pipefail; \
|
RUN --mount=type=bind,source=.,target=/app,rw \
|
||||||
|
--mount=type=cache,target=/root/.cargo/git \
|
||||||
|
--mount=type=cache,target=/root/.cargo/registry \
|
||||||
|
--mount=type=cache,target=/app/target \
|
||||||
|
set -eux -o pipefail; \
|
||||||
\
|
\
|
||||||
[ -e "$(pwd)/payment-contracts/src/contracts/mod.rs" ] || touch "$(pwd)/payment-contracts/build.rs"; \
|
[ -e "$(pwd)/payment-contracts/src/contracts/mod.rs" ] || touch "$(pwd)/payment-contracts/build.rs"; \
|
||||||
cargo install \
|
cargo install \
|
||||||
|
Loading…
Reference in New Issue
Block a user