我收到Heroku的警告说我的鼻涕虫太大了:
-----> Compressing...
Done: 304.9M
-----> Launching...
! Warning: Your slug size exceeds our soft limit (304 MB) which may affect boot time.我怎么才能缩小我的鼻涕虫大小?它是一个.NET核心2.1.401和角6应用程序,所以我使用以下构建包:
运行heroku run "du . -h --max-depth=3 --threshold=1M"将产生以下结果:
2.5M ./App/obj
524M ./App/ClientApp/node_modules
16M ./App/ClientApp/dist
9.4M ./App/ClientApp/src
549M ./App/ClientApp
2.5M ./App/bin/Release
3.3M ./App/bin
556M ./App
16M ./heroku_output/ClientApp/dist
16M ./heroku_output/ClientApp
130M ./heroku_output
189M ./.heroku/dotnet/sdk
140M ./.heroku/dotnet/shared
329M ./.heroku/dotnet
27M ./.heroku/node/lib
3.0M ./.heroku/node/include
34M ./.heroku/node/bin
63M ./.heroku/node
391M ./.heroku
11M ./.apt/usr/lib
3.3M ./.apt/usr/include
15M ./.apt/usr
15M ./.apt
1.1G .体积为node_modules/ (524M)、./heroku/dotnet/ (329 M)和./heroku_output (130 M)。
我不认为我可以使用.slugignore文件,因为构建过程需要node_modules文件夹,所以我尝试在dotnet publish之后删除node_modules/文件夹,在应用程序的.csproj中使用这个条目,但它并没有减少段塞大小。
<Target Name="CleanupNodeModules" AfterTargets="Publish">
<Exec WorkingDirectory="$(SpaRoot)" Command="rm -rf node_modules" Condition=" '$(OS)' != 'Windows_NT' " ConsoleToMSBuild="true" />
</Target>有什么想法吗?
https://stackoverflow.com/questions/52315719
复制相似问题