cloudfoundry / dotnet-core-buildpack

Cloud Foundry buildpack for .NET Core on Linux
http://docs.cloudfoundry.org/buildpacks/
Apache License 2.0
91 stars 90 forks source link

Dotnet buildpack always displays "dotnet first run" message in logs #1014

Open macsux opened 1 month ago

macsux commented 1 month ago

When running dotnet_core_buildpack it always displays "first launch" message from dotnet SDK, polluting logs. Ex:

-----> Dotnet-Core Buildpack version 2.4.30
-----> Supplying Dotnet Core
-----> Installing libunwind 1.8.1
       Copy [/tmp/buildpacks/a32ac21029fde3827cac2632ea8ee613/dependencies/d9bc4f683532d20ccd23d3fa985c236e/libunwind_1.8.1_linux_noarch_cflinuxfs4_98454ea1.tgz]
-----> Installing dotnet-sdk 8.0.302
       Copy [/tmp/buildpacks/a32ac21029fde3827cac2632ea8ee613/dependencies/d4d1cc391d667c0cf59176f907a02d71/dotnet-sdk_8.0.302_linux_x64_any-stack_6b6da5e6.tar.xz]
-----> Installing dotnet-runtime 8.0.6
       Copy [/tmp/buildpacks/a32ac21029fde3827cac2632ea8ee613/dependencies/fb4e215739afbab0e7fb65fa760ab938/dotnet-runtime_8.0.6_linux_x64_any-stack_5df0e17f.tar.xz]
-----> Finalizing Dotnet Core
-----> Installing dotnet-aspnetcore 8.0.6
       Copy [/tmp/buildpacks/a32ac21029fde3827cac2632ea8ee613/dependencies/eeba5dbe9ab53497039f54cf01fcd5b8/dotnet-aspnetcore_8.0.6_linux_x64_any-stack_8f4aa39c.tar.xz]
-----> Installing dotnet-runtime 8.0.6
       Copy [/tmp/buildpacks/a32ac21029fde3827cac2632ea8ee613/dependencies/fb4e215739afbab0e7fb65fa760ab938/dotnet-runtime_8.0.6_linux_x64_any-stack_5df0e17f.tar.xz]
-----> Publish dotnet

       Welcome to .NET 8.0!
       ---------------------
       SDK Version: 8.0.302

       Telemetry
       ---------
       The .NET tools collect usage data in order to help us improve your experience. It is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.

       Read more about .NET CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry

       ----------------
       Installed an ASP.NET Core HTTPS development certificate.
       To trust the certificate, view the instructions: https://aka.ms/dotnet-https-linux

       ----------------
       Write your first app: https://aka.ms/dotnet-hello-world
       Find out what's new: https://aka.ms/dotnet-whats-new
       Explore documentation: https://aka.ms/dotnet-docs
       Report issues and find source on GitHub: https://github.com/dotnet/core
       Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
       --------------------------------------------------------------------------------------
         Determining projects to restore...
         Restored /home/vcap/app/SampleApp.csproj (in 12.12 sec).
         SampleApp -> /home/vcap/app/bin/Debug/net8.0/linux-x64/SampleApp.dll
         SampleApp -> /tmp/contents2140895411/deps/1/dotnet_publish/
-----> Cleaning staging area
       Removing .nuget
       Removing .local
       Removing dotnet-sdk

This should be disabled by setting environmental variables as follows:

DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: 1