From ee98cef379be9548f83b6973b5b124706f5d3b20 Mon Sep 17 00:00:00 2001 From: alireza Date: Wed, 3 Jun 2026 20:48:09 +0330 Subject: [PATCH] build: optimize Docker build by skipping redundant SPA build Set SkipSpaBuild environment variable in Dockerfile to prevent MSBuild from rebuilding the frontend during publish, as it is already built in a separate stage. Also disable NuGet audit warnings to reduce build noise. --- backend/Dockerfile | 3 +++ backend/backend.csproj | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 372c9f9..b281f6f 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -11,11 +11,14 @@ FROM mcr.microsoft.com/dotnet/sdk:9.0 AS backend-build WORKDIR /src COPY nuget.config ./ COPY backend.csproj ./ +ENV DOTNET_NUGET_AUDIT=false RUN dotnet nuget list source RUN dotnet restore COPY . . # Copy the frontend build output from the previous stage COPY --from=frontend-build /app/dist ./ClientApp/dist +# Skip the SPA build in MSBuild since it's already built in Stage 1 +ENV SkipSpaBuild=true RUN dotnet publish -c Release -o /app/publish # Stage 3: Runtime diff --git a/backend/backend.csproj b/backend/backend.csproj index 8e895a7..e110326 100644 --- a/backend/backend.csproj +++ b/backend/backend.csproj @@ -39,7 +39,7 @@ - +