You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Jorge (Jira)" <ji...@apache.org> on 2020/07/14 13:23:00 UTC

[jira] [Commented] (ARROW-9359) [Rust][Dev] Cache packages and/or compilation in docker images

    [ https://issues.apache.org/jira/browse/ARROW-9359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17157358#comment-17157358 ] 

Jorge commented on ARROW-9359:
------------------------------

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.rs@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)