libsql / sqld

LibSQL with extended capabilities like HTTP protocol, replication, and more.
https://libsql.org
903 stars 38 forks source link

Make cargo-chef effective for CI builds #761

Closed athoscouto closed 1 year ago

athoscouto commented 1 year ago

This PR has two changes that should make cargo-chef effective for CI docker builds.

The first step is necessary because we can't reuse cached layers if the previous layers have changed. And layers that run apt update, rustup update and cargo install can invalidate those caches. The solution is to create an external image that has a separate lifecycle and does those unreproducible operations.

If this is accepted, we should create an sqld-builder package to store images for Dockerfile.builder.

The second step generates a tag inside the package to store the build cache (see this for example). We may choose to have a different package to store only build caches as well.


When no dependencies are changed and cargo-chef works correctly, it takes 4 minutes to build the Docker image, instead of 20.

athoscouto commented 1 year ago

My understanding of how Docker cache works was incorrect, we don't need the extra image. Closing this in favor of #763.