FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build WORKDIR /App # Copy everything COPY . ./ # Restore as distinct layers RUN dotnet restore # Build and publish a release RUN dotnet publish -c Release -o out # Build runtime image FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS deploy WORKDIR /App COPY --from=build /App/out . ENV DOTNET_EnableDiagnostics=0 EXPOSE 80 ENTRYPOINT ["dotnet", "/App/IO.Swagger.dll"]