-
Notifications
You must be signed in to change notification settings - Fork 2k
NuGetFallbackFolder adds unnecessary bloat to build containers #237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This will improve once the fallback folder is used as an actual fallback folder. Long term to solve this I'd like to see either a dotnet or NuGet command that takes a set of project.assets.json files and prunes out all unneeded files from the package folders. This would include assemblies from unused frameworks, all dlls and files not listed in the assets file, and resource dlls that aren't used. |
@emgarten is this just a preview1 limitation that will be fixed before 2.0.0 RTM? Also FYI the |
That is the current goal |
Does this help?
|
The images already set NUGET_XMLDOC_MODE=skip, but it's not honored by the first-time experience. If we decided to disable the offline package cache, setting DOTNET_SKIP_FIRST_TIME_EXPERIENCE is the best way to do that. |
Is the |
If you meant |
Ah. So this doesn't get used by |
@emgarten, What is the latest status of the underlying issue? Can you link to the product issue? |
@MichaelSimons it is tracked here: https://github.com/dotnet/cli/issues/6507 |
I logged a cli issue to add support for this scenario. There are numerous use cases which would benefit from this trimming capability. Our Dockerfiles should not have to define this trimming logic. |
The NuGetFallbackFolder is actually taking to much room in my disk : since it's only caching packages to avoid searching them online if they're not there, can we just remove all the files from the folder ? Is it safe ? Thank you for your time, |
Hey @MichaelSimons, I'd like to take a stab at this for 2.2 (after #662 is in, of course). We started producing a version of the fallback folder which trims the .nupkg and .xml files which is the biggest part of the (uncompressed) bloat. @JeanMdK yes, you can safely delete this folder. NuGet will download what you need. You are likely to find, however, that this will just shift content from the NuGetFallbackFolder to %USERPROFILE%/.nuget/packages. |
@natemcmaster - Can you provide more details on this lighter fallback folder? Is this a published artifact I can take a look at? @richlander and I have discussed this and are in favor of this for 2.2. |
Yes, there are published artifacts for this starting in 2.1.3. I've written up more details about the various package archives we produce in aspnet/Universe#1324. For Docker, you would want to use the Under the hood, NuGet restore takes a list of fallback folders in the MSBuild property There is more than one way to do this, but I would recommend the following for 2.2 previews. I'm like 80% sure this should work, but in full disclosure, I haven't tried it on all platforms, just in Azure services.
|
The SDK is removing the lzma/NuGetFallbackFolder in 3.0 and making use of targeting packs instead. The removal has already happened. Closing this issue, there are no plans to port any of this work back to previous versions. |
Uh oh!
There was an error while loading. Please reload this page.
In .NET Core 2.0, the CLI started shipping a feature that adds an offline package feed called the NuGetFallbackFolder. This adds unnecessary bloat to SDK images in the following ways:
~/.dotnet/NuGetFallbackFolder
. xmldocs are unnecessary in build images.~/.dotnet/NuGetFallbackFolder
to~/.nuget/packages
~/.nuget/packages
folder end up with a bloated image. Here is the resulting duplication between the nuget cache and fallback folders:Suggestions
Or some combination of the ideas above.
Details
How I measured the numbers
Using:
microsoft/dotnet-nightly:2.0.0-preview1-sdk
apt-get update -qq && apt-get install -y fdupes
mkdir /app && cd /app
ls ~/.nuget/
. The~/.nuget/packages/
folder does not yet exist.dotnet new web
(automatically launchesdotnet restore
)fdupes -r -m ~/.dotnet/NuGetFallbackFolder/ ~/.nuget/packages/
find ~/.nuget/packages -type f | wc -l
find ~/.dotnet -name "*.xml" -type f | wc -l
find ~/.dotnet/ -name "*.xml" -type f -print0 | du -sb --files0-from=- | awk '{ total += $1} END { print total/1024/1024 }'
(number is in MB)cc @emgarten @rrelyea @dotnet/dotnet-cli @glennc
The text was updated successfully, but these errors were encountered: