I followed the instructions I have found online and this is my dockerfile:
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build WORKDIR /source # copy csproj and r