32 lines
1.1 KiB
Docker
32 lines
1.1 KiB
Docker
# Etapa de construcción
|
|
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
|
WORKDIR /src
|
|
|
|
# Copiar archivos .sln y .csproj para restaurar dependencias
|
|
COPY MotoresArgentinosV2.sln ./
|
|
COPY Backend/MotoresArgentinosV2.API/*.csproj Backend/MotoresArgentinosV2.API/
|
|
COPY Backend/MotoresArgentinosV2.Core/*.csproj Backend/MotoresArgentinosV2.Core/
|
|
COPY Backend/MotoresArgentinosV2.Infrastructure/*.csproj Backend/MotoresArgentinosV2.Infrastructure/
|
|
COPY Backend/MotoresArgentinosV2.MigrationTool/*.csproj Backend/MotoresArgentinosV2.MigrationTool/
|
|
|
|
RUN dotnet restore
|
|
|
|
# Copiar el resto del código y construir
|
|
COPY . .
|
|
WORKDIR "/src/Backend/MotoresArgentinosV2.API"
|
|
RUN dotnet build "MotoresArgentinosV2.API.csproj" -c Release -o /app/build
|
|
|
|
# Publicar
|
|
FROM build AS publish
|
|
RUN dotnet publish "MotoresArgentinosV2.API.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
|
|
|
# Etapa final: Ejecución
|
|
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS final
|
|
WORKDIR /app
|
|
COPY --from=publish /app/publish .
|
|
|
|
# Exponer el puerto configurado (ASP.NET 10 usa 8080 por defecto en contenedores)
|
|
EXPOSE 8080
|
|
|
|
ENTRYPOINT ["dotnet", "MotoresArgentinosV2.API.dll"]
|