On every PR: build, unit and integration tests, analyzers with warnings-as-errors, dependency scan (dotnet list package --vulnerable), secret scan, mandatory human review.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # ====================================================================== # Q: Describe a good CI/CD pipeline for this service. # # - On every PR: build, unit and integration tests, analyzers with warnings-as- # errors, dependency scan (dotnet list package --vulnerable), secret scan, # mandatory human review. # - On merge to main: build the Docker image once, tagged with the commit SHA. # The same image is promoted from staging to prod. # - Deployment: migration script, deploy to Azure App Service (slot swap) or # Container Apps, smoke test, automatic rollback. # ====================================================================== # Multi-stage Dockerfile for the .NET 9 API (non-root runtime) FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build WORKDIR /src COPY *.csproj ./ RUN dotnet restore COPY . . RUN dotnet publish -c Release -o /app --no-restore FROM mcr.microsoft.com/dotnet/aspnet:9.0 WORKDIR /app COPY --from=build /app . USER $APP_UID # non-root ENTRYPOINT ["dotnet", "Api.dll"] |