I'm executing docker build command in the pipeline step. Dockerfile has commands to restore, build and publish .csproj's using mcr.microsoft.com/dotnet/sdk:8.0-alpine3.18
After upgrading .NET Core 6 projects to .NET Core 8, it's taking a lot longer to build and publish than before with Bitbucket pipeline.
Here is the time spent on each task with .NET Core 6
dotnet build - 34.3s
dotnet publish - 17.4s
Here is the time spent on each task with .NET Core 8
dotnet build - 342.5s
dotnet publish - 1399.1s
After doubling the memory size (size: 2x) of the entire pipeline step and increasing the docker service memory to 4096, it completed the tasks in less time.
Here is the time spent on each task with .NET Core 8 after doubling the memory
dotnet build - 37.0s
dotnet publish - 20.1s
It would be great if someone could provide a technical explanation of what's happening here. Is this normal behavior with .NET Core 8? Does the .NET Core 8 SDK consume a significant amount of memory?