When I created a project targeting net5.0 with the docker dependency I got
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
WORKDIR /src
COPY ["example_app.csproj", "."]
RUN dotnet restore "example_app.csproj"
COPY . .
RUN dotnet build "example_app.csproj" -c Release -o /app
FROM build AS publish
RUN dotnet publish "example_app.csproj" -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "example_app.dll"]
This should have targeted the net5 base image, not 3.1
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ["example_app.csproj", "."]
RUN dotnet restore "example_app.csproj"
COPY . .
RUN dotnet build "example_app.csproj" -c Release -o /app
FROM build AS publish
RUN dotnet publish "example_app.csproj" -c Release -o /app
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "example_app.dll"]
When I created a project targeting net5.0 with the docker dependency I got
Here is what I was hoping for