Closed amoszheng closed 1 year ago
Yes! The publish
command to create the container would reuse whatever NuGet packages cache that you've set up - this is one of the big benefits of making container generation more 'native' to the tools. You also get to seamlessly reuse your NuGet authentication, which has historically been difficult for Dockerfile-based builds.
We were looking for ways to adopt docker containers for our .NET Core web apps and discovered this native container publish feature which we found really awesome because that way we don't have to worry about our project references or maintaining Dockerfiles. However we have a question concerning caching of project dependencies in GitHub workflows to optimize build speed.
Before containerizing we would cache the
~/.nuget/packages
directory (using theactions/cache
action) so thedotnet build
process can leverage packages downloaded from previous builds. Also when using a Dockerfile we can write it so that the dependencies layer is cached properly with thedocker/build-push-action
action. How can we accomplish the same thing with the built-in container publish functionality? Does caching the~/.nuget/packages
directory in the runner still work in this case or should we look for some other ways to do that?Any help will be highly appreciated.