fix: Risolve limitazioni path lunghi Windows rimuovendo PowerShell e abbreviando percorsi

This commit is contained in:
Alessio Dal Santo
2026-01-16 14:46:39 +01:00
parent f026da047b
commit c3503c4a6f
+15 -15
View File
@@ -5,29 +5,29 @@
FROM mcr.microsoft.com/dotnet/sdk:9.0-nanoserver-ltsc2022 AS build
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/"]
COPY ["DataConnection/DataConnection.csproj", "DataConnection/"]
COPY ["CredentialManager/CredentialManager.csproj", "CredentialManager/"]
COPY ["Components/Components.csproj", "Components/"]
COPY ["Data_Coupler/Data_Coupler.csproj", "DC/"]
COPY ["DataConnection/DataConnection.csproj", "DCon/"]
COPY ["CredentialManager/CredentialManager.csproj", "CM/"]
COPY ["Components/Components.csproj", "Comp/"]
COPY ["nuget.config", "./"]
# Ripristina le dipendenze per tutti i progetti con path più corti
RUN dotnet restore "Data_Coupler/Data_Coupler.csproj" --disable-parallel
# Ripristina le dipendenze per tutti i progetti con path corti
RUN dotnet restore "DC/Data_Coupler.csproj" --disable-parallel --packages /p
# Copia tutto il codice sorgente
COPY . .
# Copia tutto il codice sorgente con struttura abbreviata
COPY ["Data_Coupler/", "DC/"]
COPY ["DataConnection/", "DCon/"]
COPY ["CredentialManager/", "CM/"]
COPY ["Components/", "Comp/"]
# Build del progetto principale
WORKDIR "/s/Data_Coupler"
RUN dotnet build "Data_Coupler.csproj" -c Release -o /app/build --no-restore
WORKDIR "/s/DC"
RUN dotnet build "Data_Coupler.csproj" -c Release -o /a/b --no-restore
# Stage 2: Publish
FROM build AS publish
RUN dotnet publish "Data_Coupler.csproj" -c Release -o /app/publish --no-restore /p:UseAppHost=false
RUN dotnet publish "Data_Coupler.csproj" -c Release -o /a/p --no-restore /p:UseAppHost=false
# Stage 3: Runtime
FROM mcr.microsoft.com/dotnet/aspnet:9.0-nanoserver-ltsc2022 AS final
@@ -37,7 +37,7 @@ WORKDIR /app
RUN mkdir C:\ProgramData\Data_Coupler
# Copia i file pubblicati
COPY --from=publish /app/publish .
COPY --from=publish /a/p .
# Configura le variabili d'ambiente
ENV ASPNETCORE_URLS=http://+:7550