FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base WORKDIR /app EXPOSE 9090 FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build WORKDIR /src COPY ["docker-dotnetcore-api.csproj", "."] RUN dotnet restore "./docker-dotnetcore-api.csproj" COPY . . WORKDIR "/src/." RUN dotnet build "docker-dotnetcore-api.csproj" -c Release -o /app/build FROM build AS publish RUN dotnet publish "docker-dotnetcore-api.csproj" -c Release -o /app/publish FROM base AS final WORKDIR /app COPY --from=publish /app/publish . ENTRYPOINT ["dotnet", "docker-dotnetcore-api.dll"]