BuildKit caching arguments
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Is your feature request related to a problem? Please describe the problem.
I am trying to persist the npm cache for my JavaScript app across CI builds. The default image created by `AddJavaScriptApp` uses the internal BuildKit cache (`RUN --mount=type=cache,target=/root/.npm`). To be able to reuse the cache across pipeline runes, I'd like to use a different [backend](https://docs.docker.com/build/cache/backends/), e.g. a local directory on an Azure Pipelines build agent in combination with the [Cache task](https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/cache-v2?view=azure-pipelines).
In order to do that, I would need to add additional arguments (`--cache-to` and `cache-from`) to the `docker buildx build` call in the container runtime, but while there is an option for build arguments, I couldn't find a way to add arguments to the call itself (see [DockerContainerRuntime](https://github.com/dotnet/aspire/blob/main/src/Aspire.Hosting/Publishing/DockerContainerRuntime.cs#L49) for example).
### Describe the solution you'd like
I'd like to either have a possibility to control these caching arguments directly, or a generic way to add additional arguments to the image building call.
### Additional context
This is not only about build performance. We use [Font Awesome](https://fontawesome.com/) which bills us for the bandwidth used during package loads.
Contributor guide
Assessment
This issue has not been assessed yet.