# --- Build stage --- FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build WORKDIR /src # copy solution + project files first (for caching) COPY JSMR.sln ./ COPY JSMR.Api/JSMR.Api.csproj JSMR.Api/ COPY JSMR.Application/JSMR.Application.csproj JSMR.Application/ COPY JSMR.Domain/JSMR.Domain.csproj JSMR.Domain/ COPY JSMR.Infrastructure/JSMR.Infrastructure.csproj JSMR.Infrastructure/ RUN dotnet restore JSMR.Api/JSMR.Api.csproj # now copy the rest and publish COPY . . RUN dotnet publish JSMR.Api/JSMR.Api.csproj -c Release -o /app/publish --no-restore # --- Runtime stage --- FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS runtime WORKDIR /app COPY --from=build /app/publish ./ ENV ASPNETCORE_URLS=http://+:8080 EXPOSE 8080 ENTRYPOINT ["dotnet", "JSMR.Api.dll"]