fix: Resolve Windows path length limitations in Dockerfile
This commit is contained in:
+9
-6
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user