-
Notifications
You must be signed in to change notification settings - Fork 8
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
Going further #34
Comments
In addition dependencies should be built with an empty docker context. The Dockerfile generated on the fly should first look for hashed dependencies available over the network (i.e. does the image A build A thing I haven't mentioned yet: the hash of a dependency should be a cryptographic hash of the inputs of that dependency, à la Nix. |
fyi, I did some initial work for Dockerfile cross-compile support via |
Ah thanks for the heads up on your I am not finding any emphasizing on build results reuse in |
@fenollp |
I'd like to discuss the future of
cargo-wharf
and to this extent some ideas I'd like to collaborate on.Cache integration and the case for a community-backed global cache
Recent versions of
docker build
support--output=PATH
which copies files out of an image. This allows for writing the compilation results of each dependency to the filesystem of the local machine or of a CI cache.cargo
has a way of specifying where to look for build artifacts other than the sometimes-empty./target/
dir:CARGO_TARGET_DIR
.More on
CARGO_TARGET_DIR
Per https://stackoverflow.com/a/37472558/1418165 it turns out that a shared
CARGO_TARGET_DIR
(orCARGO_BUILD_TARGET_DIR
)"target"
per Allow specifying a custom output directory rust-lang/cargo#1657 (comment)These would have to be part of the hashed name of each dependency being built (the dependency path or the docker tag).
To solve hermeticity issues, see
cross
cross
already does a good job of building Rust projects (on various platform triplets) using docker (docker run
) and QEMU.This work should be adapted (in a way that can be most easily maintainable) to use BuildKit, its QEMU integration, its rootless capabilities and its ability to run the compute graph with maximum parallelization.
Conclusion
So if
cargo-wharf
where to create hermetic BuildKit targets for each dependency, leveraging the work oncross
, I think there'd be a seamless way to integrate both local and global caches for dependencies. This global cache (basically a Docker Registry) could then be paid for by the community and profit the community.To get there I see these development steps:
cargo-wharf
, hashed and hermeticcross
's.--mount=from=HASHEDDEP,source=...,target=...
as read-onlydocker build
this Dockerfile as thecargo build
equivalent. Same forcargo test
.Note that that global docker registry
DOCKER_HOST=ssh://lotsa.oompf.machine.com cargo build
, only the final build results would then be transferred over the network.Ideas, thoughts, notes, criticism please shoot.
The text was updated successfully, but these errors were encountered: