k-khr / docker-buildkit-cargo-example

The minimal example of the Docker multi-stage build with BuildKit caching for Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

docker-buildkit-cargo-example

The minimal example of the Docker multi-stage build with BuildKit caching for Rust

Usage

  1. first build
$ DOCKER_BUILDKIT=1 docker build .
[+] Building 51.7s (17/17) FINISHED
...
  1. modify src/main.rs like
7c7
<     println!("{}", y);
---
>     // println!("{}", y);
  1. second build
$ DOCKER_BUILDKIT=1 docker build .
[+] Building 5.5s (17/17) FINISHED
...

The build time was reduced by 89%: 51.7s -> 5.5s

About

The minimal example of the Docker multi-stage build with BuildKit caching for Rust


Languages

Language:Dockerfile 75.0%Language:Rust 25.0%