[ https://issues.apache.org/jira/browse/ARROW-9359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17157358#comment-17157358 ]
Jorge edited comment on ARROW-9359 at 7/14/20, 1:22 PM: -------------------------------------------------------- One idea that I often use: {code} # use specific version here to freeze layer FROM rust:1.44.1-buster AS backend-builder # freeze the version for deterministic builds RUN rustup update nightly-2020-07-03 && rustup default nightly-2020-07-03 # Compile a dummy program, so that the dependencies are compiled and cached on a layer # see https://stackoverflow.com/a/58474618/931303 for details RUN echo "fn main() {}" > dummy.rs ## if cargo.lock or cargo changes, we trigger a build of all dependencies. COPY backend/Cargo.lock backend/Cargo.toml / RUN sed -i 's@src/main...@dummy.rs@' Cargo.toml RUN cargo build --release RUN sed -i 's...@dummy.rs@src/main.rs@' Cargo.toml # compile the actual program COPY ... RUN cargo build --release {code} was (Author: jorgecarleitao): One idea that I often use: {code:docker} # use specific version here to freeze layer FROM rust:1.44.1-buster AS backend-builder # freeze the version for deterministic builds RUN rustup update nightly-2020-07-03 && rustup default nightly-2020-07-03 # Compile a dummy program, so that the dependencies are compiled and cached on a layer # see https://stackoverflow.com/a/58474618/931303 for details RUN echo "fn main() {}" > dummy.rs ## if cargo.lock or cargo changes, we trigger a build of all dependencies. COPY backend/Cargo.lock backend/Cargo.toml / RUN sed -i 's@src/main...@dummy.rs@' Cargo.toml RUN cargo build --release RUN sed -i 's...@dummy.rs@src/main.rs@' Cargo.toml # compile the actual program COPY ... RUN cargo build --release {code} > [Rust][Dev] Cache packages and/or compilation in docker images > -------------------------------------------------------------- > > Key: ARROW-9359 > URL: https://issues.apache.org/jira/browse/ARROW-9359 > Project: Apache Arrow > Issue Type: Wish > Components: Developer Tools, Rust > Reporter: Antoine Pitrou > Priority: Major > > To improve the local development experience, it would be nice if the Docker > setup for Rust builds could cache packages from run to run. -- This message was sent by Atlassian Jira (v8.3.4#803005)