Skip to content
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

caching support #152

Open
Lunarequest opened this issue Oct 25, 2022 · 2 comments
Open

caching support #152

Lunarequest opened this issue Oct 25, 2022 · 2 comments

Comments

@Lunarequest
Copy link

When using docker we often setup a cache for things to download(eg cargo metadata & packages) and sometimes things that are compiled eg rust libs etc since rust can incrementally rebuild based on only what needs to be rebuilt. An example would be'

RUN --mount=type=cache,target=/usr/local/cargo/registry \
    --mount=type=cache,target=/app/target \
    cargo build --release

This allows for large projects to be build in minutes, especially when cross compiling for non-native archs(eg aarch64 on amd64) normally due having to clean build from scratch this cause build times to be almost half a day on medium/large size rust projects when cross compiling.

@kaniini
Copy link
Contributor

kaniini commented Nov 2, 2022

It seems reasonable to have, but some care will have to be put into how the caches get maintained. I'm inclined to leave that as a concern outside melange itself, as different users will have different usecases.

There is already --cache-dir, which could be extended for this purpose. What do you think, @imjasonh?

@imjasonh
Copy link
Member

imjasonh commented Nov 2, 2022

I'm for it.

In theory folks can already do this today at head, but it's a bit of a hack, and we could make it more sturdy and flexible.

The current implementation added in #143 just makes the directory /var/cache/melange accessible to the build environment, so if one build writes to /var/cache/melange/hello then a subsequent build can read it. This is used by fetch to avoid wgets if possible. If we decide to recommend this for broader usage we should document or require checksum checking to avoid cache poisoning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants