From 912693bf0a4063e9835b18dd61b02f0840db6345 Mon Sep 17 00:00:00 2001 From: teor Date: Thu, 15 Jun 2023 08:15:51 +1000 Subject: [PATCH] Fix Dockerfile cache use (#6933) --- docker/Dockerfile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 36c6751b4..4f21f9aee 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -107,10 +107,11 @@ COPY --from=us-docker.pkg.dev/zealous-zebra/zebra/lightwalletd /opt/lightwalletd # # This is the caching Docker layer for Rust! # -# TODO: is it faster to use --tests here? -RUN cargo chef cook --release --features "${TEST_FEATURES} ${FEATURES}" --workspace --recipe-path recipe.json +# TODO: add --locked when cargo-chef supports it +RUN cargo chef cook --tests --release --features "${TEST_FEATURES} ${FEATURES}" --workspace --recipe-path recipe.json COPY . . +# Test Zebra RUN cargo test --locked --release --features "${TEST_FEATURES} ${FEATURES}" --workspace --no-run RUN cp /opt/zebrad/target/release/zebrad /usr/local/bin RUN cp /opt/zebrad/target/release/zebra-checkpoints /usr/local/bin @@ -127,10 +128,12 @@ ENTRYPOINT [ "/entrypoint.sh" ] # `test` stage. This step is a dependency for the `runtime` stage, which uses the resulting # zebrad binary from this step. FROM deps AS release -RUN cargo chef cook --release --features "${FEATURES}" --recipe-path recipe.json + +# TODO: add --locked when cargo-chef supports it +RUN cargo chef cook --release --features "${FEATURES}" --package zebrad --bin zebrad --recipe-path recipe.json COPY . . -# Build zebra +# Build zebrad RUN cargo build --locked --release --features "${FEATURES}" --package zebrad --bin zebrad COPY ./docker/runtime-entrypoint.sh /