Provide guidance on utilizing NuGet package caches for build scenarios
Within the .NET community there are users asking/discussing the best/recommended patterns for utilizing a NuGet package cache while building their .NET projects with Docker. Here is a recent example.
There are two main scenarios which have very different solutions.
- Building .NET projects within Dockerfiles
- Building .NET projects within a running container
It would be beneficial to have some guidance for these scenarios. Creating a snippet on this topic feels like a good way to capture the guidance.
[Triage] The mount feature of Docker can help with implementing this, described here: https://github.com/dotnet/dotnet-docker/issues/2457.
Here's an example: https://github.com/dotnet/dotnet-docker/blob/main/samples/releasesapi/Dockerfile.ubuntu-chiseled. It would be good to have a performance test (of sorts) that validates the benefit of the mounts.
docker init Dockerfiles also use this syntax.