Skip to content
This repository has been archived by the owner on Oct 18, 2023. It is now read-only.

Use cargo-chef #549

Merged
merged 1 commit into from
Jul 26, 2023
Merged

Use cargo-chef #549

merged 1 commit into from
Jul 26, 2023

Conversation

haaawk
Copy link
Collaborator

@haaawk haaawk commented Jul 25, 2023

cargo-chef allows to split downloading and building dependencies from building the actual project. This allows docker to cache a layer that downloads and builds dependencies and rebuild only the project instead.

This change reduced the incremental build for me by over 60% from 327s to 130s.

cargo-chef allows to split downloading and building dependencies
from building the actual project. This allows docker to cache a layer
that downloads and builds dependencies and rebuild only the project
instead.

This change reduced the incremental build for me by over 60% from 327s to 130s.

Signed-off-by: Piotr Jastrzebski <[email protected]>
Comment on lines +13 to +16
RUN cat rust-toolchain.toml | grep "channel" | awk '{print $3}' | sed 's/\"//g' > toolchain.txt \
&& rustup update $(cat toolchain.txt) \
&& rustup default $(cat toolchain.txt) \
&& rm toolchain.txt rust-toolchain.toml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still needed? If the toolchain file is in the root of the cargo workspace it should pick it up?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is entirely possible. Let me check and get back to you :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually even if rust-toolchain.toml is picked up. Not running rustup update here will cause the toolchain to be installed on each step instead of installing it once so this way it's faster and cached better.

@haaawk haaawk added this pull request to the merge queue Jul 26, 2023
Merged via the queue into main with commit dd0edc5 Jul 26, 2023
@haaawk haaawk deleted the docker branch July 27, 2023 07:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants