feat: Configuración inicial de Docker Compose, Nginx y proyectos .NET

This commit is contained in:
2025-08-14 12:37:57 -03:00
parent 2fd30d1a2e
commit d9bcfd7086
38 changed files with 967 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
# --- Etapa 1: Build ---
# Usamos la imagen del SDK de .NET 9 para compilar
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src
# Copiamos los archivos .csproj para restaurar dependencias
COPY ["src/Elecciones.Api/Elecciones.Api.csproj", "Elecciones.Api/"]
COPY ["src/Elecciones.Infrastructure/Elecciones.Infrastructure.csproj", "Elecciones.Infrastructure/"]
COPY ["src/Elecciones.Core/Elecciones.Core.csproj", "Elecciones.Core/"]
COPY ["src/Elecciones.Database/Elecciones.Database.csproj", "Elecciones.Database/"]
RUN dotnet restore "Elecciones.Api/Elecciones.Api.csproj"
# Copiamos el resto del código fuente
COPY src/. .
# Publicamos la aplicación en modo Release
WORKDIR "/src/Elecciones.Api"
RUN dotnet publish "Elecciones.Api.csproj" -c Release -o /app/publish
# --- Etapa 2: Final ---
# Usamos la imagen de runtime de ASP.NET, mucho más ligera
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS final
WORKDIR /app
COPY --from=build /app/publish .
ENTRYPOINT ["dotnet", "Elecciones.Api.dll"]