fix: Resolve Windows path length limitations in Dockerfile
This commit is contained in:
+9
-6
@@ -3,7 +3,10 @@
|
|||||||
|
|
||||||
# Stage 1: Build
|
# Stage 1: Build
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:9.0-nanoserver-ltsc2022 AS 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
|
# Copia i file di progetto e ripristina le dipendenze
|
||||||
COPY ["Data_Coupler/Data_Coupler.csproj", "Data_Coupler/"]
|
COPY ["Data_Coupler/Data_Coupler.csproj", "Data_Coupler/"]
|
||||||
@@ -12,19 +15,19 @@ COPY ["CredentialManager/CredentialManager.csproj", "CredentialManager/"]
|
|||||||
COPY ["Components/Components.csproj", "Components/"]
|
COPY ["Components/Components.csproj", "Components/"]
|
||||||
COPY ["nuget.config", "./"]
|
COPY ["nuget.config", "./"]
|
||||||
|
|
||||||
# Ripristina le dipendenze per tutti i progetti
|
# Ripristina le dipendenze per tutti i progetti con path più corti
|
||||||
RUN dotnet restore "Data_Coupler/Data_Coupler.csproj"
|
RUN dotnet restore "Data_Coupler/Data_Coupler.csproj" --disable-parallel
|
||||||
|
|
||||||
# Copia tutto il codice sorgente
|
# Copia tutto il codice sorgente
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Build del progetto principale
|
# Build del progetto principale
|
||||||
WORKDIR "/src/Data_Coupler"
|
WORKDIR "/s/Data_Coupler"
|
||||||
RUN dotnet build "Data_Coupler.csproj" -c Release -o /app/build
|
RUN dotnet build "Data_Coupler.csproj" -c Release -o /app/build --no-restore
|
||||||
|
|
||||||
# Stage 2: Publish
|
# Stage 2: Publish
|
||||||
FROM build AS 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
|
# Stage 3: Runtime
|
||||||
FROM mcr.microsoft.com/dotnet/aspnet:9.0-nanoserver-ltsc2022 AS final
|
FROM mcr.microsoft.com/dotnet/aspnet:9.0-nanoserver-ltsc2022 AS final
|
||||||
|
|||||||
Reference in New Issue
Block a user