Reputation: 12107
Being in a new area in a lockdown zone, I only have access to badly overpriced sim card data plans right now and I am looking for a way to minimize bandwidth.
I have an app that has a regular dockerfile for its build, but it will go online to restore packages every time.
I am on MacOS and the build process doesn't need to be portable.
Since I have a local nuget package cache (~/.nuget/packages), I would like to leverage this and re-use these files.
First, I would like to point out that doing a publish from my IDE and using that result is not an option with this project, I really need to build it from source.
There are also numerous discussions on either directly or semi-related situation and a few blog posts and none seem to come up with an ideal solution. I did quite an extensive search. If you think this is a duplicate of an existing post with a valid solution, please have a close look.
Things I have looked at:
What I am currently looking at is:
one issue is that I can't hardcode the fsproj dependencies and it is not possible to find all the project files from inside the dockerfile. One blog post suggests a pre-process where the files are found, put in an archive, and expand it in the dockerfile.
before I start to go on some convoluted path, has anyone tried to solve this problem before? or came up with a good clean solution?
edit:
docker will not access symlinks pointing outside of the build directory
Upvotes: 8
Views: 5506
Reputation: 416
One suggestion I have to look into Docker BuildKit if you have not done so already. BuildKit adds support for Dockerfile mounts. It supports various types of mounts one being a cache intended for this exact scenario - build cache artifacts such as NuGet packages.
Upvotes: 5