From f026da047b865e2e8251e2c2d87ce755f8a8c82f Mon Sep 17 00:00:00 2001 From: Alessio Dal Santo Date: Fri, 16 Jan 2026 14:32:40 +0100 Subject: [PATCH] fix: Resolve Windows path length limitations in Dockerfile --- Dockerfile.windows | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Dockerfile.windows b/Dockerfile.windows index 85d4c33..134e0a7 100644 --- a/Dockerfile.windows +++ b/Dockerfile.windows @@ -3,7 +3,10 @@ # Stage 1: Build FROM mcr.microsoft.com/dotnet/sdk:9.0-nanoserver-ltsc2022 AS build -WORKDIR /src +WORKDIR /s + +# Abilita long paths per Windows +RUN powershell -Command "New-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -Value 1 -PropertyType DWORD -Force; exit 0" # Copia i file di progetto e ripristina le dipendenze COPY ["Data_Coupler/Data_Coupler.csproj", "Data_Coupler/"] @@ -12,19 +15,19 @@ COPY ["CredentialManager/CredentialManager.csproj", "CredentialManager/"] COPY ["Components/Components.csproj", "Components/"] COPY ["nuget.config", "./"] -# Ripristina le dipendenze per tutti i progetti -RUN dotnet restore "Data_Coupler/Data_Coupler.csproj" +# Ripristina le dipendenze per tutti i progetti con path più corti +RUN dotnet restore "Data_Coupler/Data_Coupler.csproj" --disable-parallel # Copia tutto il codice sorgente COPY . . # Build del progetto principale -WORKDIR "/src/Data_Coupler" -RUN dotnet build "Data_Coupler.csproj" -c Release -o /app/build +WORKDIR "/s/Data_Coupler" +RUN dotnet build "Data_Coupler.csproj" -c Release -o /app/build --no-restore # Stage 2: Publish FROM build AS publish -RUN dotnet publish "Data_Coupler.csproj" -c Release -o /app/publish /p:UseAppHost=false +RUN dotnet publish "Data_Coupler.csproj" -c Release -o /app/publish --no-restore /p:UseAppHost=false # Stage 3: Runtime FROM mcr.microsoft.com/dotnet/aspnet:9.0-nanoserver-ltsc2022 AS final