-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cache CARGO_HOME #25
Comments
I did some testing on this and setting |
Looked into this a bit more. When You can set Testing locally, this doesn't happen. Nor does testing with Dockerfile & I suspect that this has to do with the way the cache layer is being restored & that the old mtimes are not persisted. Thus what you have is the mtime set to the time the file was extracted, not the time it was originally written by the Rust compiler. When you |
- Remove buildpack's layer caching. Caching for the layer could be difficult, so removing it just leaves things up to Cargo which is the most accurate - Creates two folders under the cargo cache layer, `target/` and `home/`. The former is where build files go while the latter is where `cargo` cached downloads, like from crates.io go. - At the moment, a layer cached by the lifecycle does not preserve file mtimes. They are squashed in the name of reproducible builds. To get around this, the buildpack will preserve the mtimes of everything install, after cargo runs & then restore them the next time before cargo runs. This keeps consistent file mtimes, which is necessary for cargo to work properly. - Removes unnecessary directories from cargo's home directory, based on https://doc.rust-lang.org/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci, which saves space on the cache layer. Resolves: #24 and #25
- Remove buildpack's layer caching. Caching for the layer could be difficult, so removing it just leaves things up to Cargo which is the most accurate - Creates two folders under the cargo cache layer, `target/` and `home/`. The former is where build files go while the latter is where `cargo` cached downloads, like from crates.io go. - At the moment, a layer cached by the lifecycle does not preserve file mtimes. They are squashed in the name of reproducible builds. To get around this, the buildpack will preserve the mtimes of everything install, after cargo runs & then restore them the next time before cargo runs. This keeps consistent file mtimes, which is necessary for cargo to work properly. - Removes unnecessary directories from cargo's home directory, based on https://doc.rust-lang.org/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci, which saves space on the cache layer. Resolves: #24 and #25
Closed by #41 |
Cargo stores downloaded into $CARGO_HOME, which defaults to
$HOME/.cargo
. That is not going to be useful in CNBS, so we should be setting $CARGO_HOME to a layer that is set with build + cache flags. That way downloaded resources are restored for subsequent runs of the buildpack & if something needs to be recompiled, Cargo will not need to hit the Internet to download resources again.The entire folder does not need to be cached though. This actually retains some duplicate information. According to this doc link we can trim down the size a bit by storing only these folder:
The text was updated successfully, but these errors were encountered: