The minimal example of the Docker multi-stage build with BuildKit caching for Rust
- first build
$ DOCKER_BUILDKIT=1 docker build .
[+] Building 51.7s (17/17) FINISHED
...
- modify
src/main.rs
like
7c7
< println!("{}", y);
---
> // println!("{}", y);
- second build
$ DOCKER_BUILDKIT=1 docker build .
[+] Building 5.5s (17/17) FINISHED
...
The build time was reduced by 89%: 51.7s
-> 5.5s