FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build-env WORKDIR /Server # stops restore during build COPY Server.csproj ./ RUN dotnet restore COPY . ./ RUN dotnet publish -c Release -o out # Build runtime image FROM mcr.microsoft.com/dotnet/aspnet:7.0 WORKDIR /Server COPY --from=build-env /Server/out . ENTRYPOINT ["dotnet", "Server.dll"]