2025-06-14 22:11:02 -03:00
|
|
|
# --- Etapa 1: Build ---
|
|
|
|
|
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
|
|
|
|
|
WORKDIR /src
|
|
|
|
|
|
2025-06-20 11:38:26 -03:00
|
|
|
# Copia solo los archivos de proyecto primero para cachear dependencias
|
2025-06-14 22:11:02 -03:00
|
|
|
COPY GestionIntegralWeb.sln .
|
|
|
|
|
COPY Backend/GestionIntegral.Api/GestionIntegral.Api.csproj Backend/GestionIntegral.Api/
|
|
|
|
|
|
2025-06-20 11:38:26 -03:00
|
|
|
# Restaura dependencias
|
2025-06-14 22:11:02 -03:00
|
|
|
RUN dotnet restore "GestionIntegralWeb.sln"
|
|
|
|
|
|
2025-06-20 11:38:26 -03:00
|
|
|
# Copia el resto del código
|
2025-06-14 22:11:02 -03:00
|
|
|
COPY . .
|
|
|
|
|
|
2025-06-20 11:38:26 -03:00
|
|
|
# Construye el proyecto
|
2025-06-14 22:11:02 -03:00
|
|
|
WORKDIR "/src/Backend/GestionIntegral.Api"
|
|
|
|
|
RUN dotnet build "GestionIntegral.Api.csproj" -c Release -o /app/build
|
|
|
|
|
|
|
|
|
|
# --- Etapa 2: Publish ---
|
|
|
|
|
FROM build AS publish
|
|
|
|
|
RUN dotnet publish "GestionIntegral.Api.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
|
|
|
|
|
|
|
|
|
# --- Etapa 3: Final ---
|
|
|
|
|
FROM mcr.microsoft.com/dotnet/aspnet:9.0
|
|
|
|
|
WORKDIR /app
|
2025-06-19 17:17:50 -03:00
|
|
|
COPY --from=publish /app/publish .
|
|
|
|
|
|
2025-06-14 22:11:02 -03:00
|
|
|
EXPOSE 8080
|
|
|
|
|
ENTRYPOINT ["dotnet", "GestionIntegral.Api.dll"]
|