Exploring the problem of faster Cargo Docker builds
This is the most popular issue on the Cargo repository. The issue revolves around the fact that currently, it is not trivial to define Dockerfiles for Cargo projects that would skip rebuilding dependencies after any source code change. This means that each Docker build of a Cargo project can be quite slow and Docker layer caching cannot be used to its full effect, unlike with some other builds systems, e.g. npm (NodeJS), pip (Python) or gem (Ruby), where it's quite straightforward.
I created a summary document that tries to describe the exact problem users are facing, why is it more difficult for Cargo than for other build systems, and what are the potential workarounds.
To improve the status quo, we would like to first gather information from Rust users to better understand the problem domain.
If you use Cargo with Docker and you suffer from long Docker image rebuild times because the compilation of dependencies is not cached, we'd be glad for your feedback. Specifically, we'd like to know if you use cargo chef or Docker cache mounts. If not, why not? If yes, are there any problems/issues that you face with these workarounds?
You can post your experiences here or on the GitHub issue.