feat: Configuración inicial de Docker Compose, Nginx y proyectos .NET
This commit is contained in:
25
Elecciones-Web/src/Elecciones.Api/Dockerfile
Normal file
25
Elecciones-Web/src/Elecciones.Api/Dockerfile
Normal 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"]
|
||||||
17
Elecciones-Web/src/Elecciones.Api/Elecciones.Api.csproj
Normal file
17
Elecciones-Web/src/Elecciones.Api/Elecciones.Api.csproj
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.5" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Elecciones.Infrastructure\Elecciones.Infrastructure.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
6
Elecciones-Web/src/Elecciones.Api/Elecciones.Api.http
Normal file
6
Elecciones-Web/src/Elecciones.Api/Elecciones.Api.http
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
@Elecciones.Api_HostAddress = http://localhost:5217
|
||||||
|
|
||||||
|
GET {{Elecciones.Api_HostAddress}}/weatherforecast/
|
||||||
|
Accept: application/json
|
||||||
|
|
||||||
|
###
|
||||||
41
Elecciones-Web/src/Elecciones.Api/Program.cs
Normal file
41
Elecciones-Web/src/Elecciones.Api/Program.cs
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
|
// Add services to the container.
|
||||||
|
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
|
||||||
|
builder.Services.AddOpenApi();
|
||||||
|
|
||||||
|
var app = builder.Build();
|
||||||
|
|
||||||
|
// Configure the HTTP request pipeline.
|
||||||
|
if (app.Environment.IsDevelopment())
|
||||||
|
{
|
||||||
|
app.MapOpenApi();
|
||||||
|
}
|
||||||
|
|
||||||
|
app.UseHttpsRedirection();
|
||||||
|
|
||||||
|
var summaries = new[]
|
||||||
|
{
|
||||||
|
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||||
|
};
|
||||||
|
|
||||||
|
app.MapGet("/weatherforecast", () =>
|
||||||
|
{
|
||||||
|
var forecast = Enumerable.Range(1, 5).Select(index =>
|
||||||
|
new WeatherForecast
|
||||||
|
(
|
||||||
|
DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
|
||||||
|
Random.Shared.Next(-20, 55),
|
||||||
|
summaries[Random.Shared.Next(summaries.Length)]
|
||||||
|
))
|
||||||
|
.ToArray();
|
||||||
|
return forecast;
|
||||||
|
})
|
||||||
|
.WithName("GetWeatherForecast");
|
||||||
|
|
||||||
|
app.Run();
|
||||||
|
|
||||||
|
record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary)
|
||||||
|
{
|
||||||
|
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||||
|
"profiles": {
|
||||||
|
"http": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"launchBrowser": false,
|
||||||
|
"applicationUrl": "http://localhost:5217",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"https": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"launchBrowser": false,
|
||||||
|
"applicationUrl": "https://localhost:7193;http://localhost:5217",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
9
Elecciones-Web/src/Elecciones.Api/appsettings.json
Normal file
9
Elecciones-Web/src/Elecciones.Api/appsettings.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"AllowedHosts": "*"
|
||||||
|
}
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
{
|
||||||
|
"format": 1,
|
||||||
|
"restore": {
|
||||||
|
"E:\\Elecciones-2025\\Elecciones-Web\\src\\Elecciones.Api\\Elecciones.Api.csproj": {}
|
||||||
|
},
|
||||||
|
"projects": {
|
||||||
|
"E:\\Elecciones-2025\\Elecciones-Web\\src\\Elecciones.Api\\Elecciones.Api.csproj": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"restore": {
|
||||||
|
"projectUniqueName": "E:\\Elecciones-2025\\Elecciones-Web\\src\\Elecciones.Api\\Elecciones.Api.csproj",
|
||||||
|
"projectName": "Elecciones.Api",
|
||||||
|
"projectPath": "E:\\Elecciones-2025\\Elecciones-Web\\src\\Elecciones.Api\\Elecciones.Api.csproj",
|
||||||
|
"packagesPath": "C:\\Users\\dmolinari\\.nuget\\packages\\",
|
||||||
|
"outputPath": "E:\\Elecciones-2025\\Elecciones-Web\\src\\Elecciones.Api\\obj\\",
|
||||||
|
"projectStyle": "PackageReference",
|
||||||
|
"fallbackFolders": [
|
||||||
|
"D:\\Microsoft\\VisualStudio\\Microsoft Visual Studio\\Shared\\NuGetPackages"
|
||||||
|
],
|
||||||
|
"configFilePaths": [
|
||||||
|
"C:\\Users\\dmolinari\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||||
|
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
|
||||||
|
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
||||||
|
],
|
||||||
|
"originalTargetFrameworks": [
|
||||||
|
"net9.0"
|
||||||
|
],
|
||||||
|
"sources": {
|
||||||
|
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||||
|
"https://api.nuget.org/v3/index.json": {}
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"net9.0": {
|
||||||
|
"targetAlias": "net9.0",
|
||||||
|
"projectReferences": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"warningProperties": {
|
||||||
|
"warnAsError": [
|
||||||
|
"NU1605"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"restoreAuditProperties": {
|
||||||
|
"enableAudit": "true",
|
||||||
|
"auditLevel": "low",
|
||||||
|
"auditMode": "direct"
|
||||||
|
},
|
||||||
|
"SdkAnalysisLevel": "9.0.300"
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"net9.0": {
|
||||||
|
"targetAlias": "net9.0",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.AspNetCore.OpenApi": {
|
||||||
|
"target": "Package",
|
||||||
|
"version": "[9.0.5, )"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"imports": [
|
||||||
|
"net461",
|
||||||
|
"net462",
|
||||||
|
"net47",
|
||||||
|
"net471",
|
||||||
|
"net472",
|
||||||
|
"net48",
|
||||||
|
"net481"
|
||||||
|
],
|
||||||
|
"assetTargetFallback": true,
|
||||||
|
"warn": true,
|
||||||
|
"frameworkReferences": {
|
||||||
|
"Microsoft.AspNetCore.App": {
|
||||||
|
"privateAssets": "none"
|
||||||
|
},
|
||||||
|
"Microsoft.NETCore.App": {
|
||||||
|
"privateAssets": "all"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.300/PortableRuntimeIdentifierGraph.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
|
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
|
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||||
|
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
||||||
|
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
||||||
|
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||||
|
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\dmolinari\.nuget\packages\;D:\Microsoft\VisualStudio\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
|
||||||
|
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||||
|
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.14.0</NuGetToolVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
|
<SourceRoot Include="C:\Users\dmolinari\.nuget\packages\" />
|
||||||
|
<SourceRoot Include="D:\Microsoft\VisualStudio\Microsoft Visual Studio\Shared\NuGetPackages\" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
|
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
||||||
6
Elecciones-Web/src/Elecciones.Core/Class1.cs
Normal file
6
Elecciones-Web/src/Elecciones.Core/Class1.cs
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Elecciones.Core;
|
||||||
|
|
||||||
|
public class Class1
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
{
|
||||||
|
"format": 1,
|
||||||
|
"restore": {
|
||||||
|
"E:\\Elecciones-2025\\Elecciones-Web\\src\\Elecciones.Core\\Elecciones.Core.csproj": {}
|
||||||
|
},
|
||||||
|
"projects": {
|
||||||
|
"E:\\Elecciones-2025\\Elecciones-Web\\src\\Elecciones.Core\\Elecciones.Core.csproj": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"restore": {
|
||||||
|
"projectUniqueName": "E:\\Elecciones-2025\\Elecciones-Web\\src\\Elecciones.Core\\Elecciones.Core.csproj",
|
||||||
|
"projectName": "Elecciones.Core",
|
||||||
|
"projectPath": "E:\\Elecciones-2025\\Elecciones-Web\\src\\Elecciones.Core\\Elecciones.Core.csproj",
|
||||||
|
"packagesPath": "C:\\Users\\dmolinari\\.nuget\\packages\\",
|
||||||
|
"outputPath": "E:\\Elecciones-2025\\Elecciones-Web\\src\\Elecciones.Core\\obj\\",
|
||||||
|
"projectStyle": "PackageReference",
|
||||||
|
"fallbackFolders": [
|
||||||
|
"D:\\Microsoft\\VisualStudio\\Microsoft Visual Studio\\Shared\\NuGetPackages"
|
||||||
|
],
|
||||||
|
"configFilePaths": [
|
||||||
|
"C:\\Users\\dmolinari\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||||
|
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
|
||||||
|
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
||||||
|
],
|
||||||
|
"originalTargetFrameworks": [
|
||||||
|
"net9.0"
|
||||||
|
],
|
||||||
|
"sources": {
|
||||||
|
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||||
|
"https://api.nuget.org/v3/index.json": {}
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"net9.0": {
|
||||||
|
"targetAlias": "net9.0",
|
||||||
|
"projectReferences": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"warningProperties": {
|
||||||
|
"warnAsError": [
|
||||||
|
"NU1605"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"restoreAuditProperties": {
|
||||||
|
"enableAudit": "true",
|
||||||
|
"auditLevel": "low",
|
||||||
|
"auditMode": "direct"
|
||||||
|
},
|
||||||
|
"SdkAnalysisLevel": "9.0.300"
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"net9.0": {
|
||||||
|
"targetAlias": "net9.0",
|
||||||
|
"imports": [
|
||||||
|
"net461",
|
||||||
|
"net462",
|
||||||
|
"net47",
|
||||||
|
"net471",
|
||||||
|
"net472",
|
||||||
|
"net48",
|
||||||
|
"net481"
|
||||||
|
],
|
||||||
|
"assetTargetFallback": true,
|
||||||
|
"warn": true,
|
||||||
|
"frameworkReferences": {
|
||||||
|
"Microsoft.NETCore.App": {
|
||||||
|
"privateAssets": "all"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.300/PortableRuntimeIdentifierGraph.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
|
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
|
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||||
|
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
||||||
|
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
||||||
|
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||||
|
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\dmolinari\.nuget\packages\;D:\Microsoft\VisualStudio\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
|
||||||
|
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||||
|
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.14.0</NuGetToolVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
|
<SourceRoot Include="C:\Users\dmolinari\.nuget\packages\" />
|
||||||
|
<SourceRoot Include="D:\Microsoft\VisualStudio\Microsoft Visual Studio\Shared\NuGetPackages\" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
|
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
||||||
6
Elecciones-Web/src/Elecciones.Database/Class1.cs
Normal file
6
Elecciones-Web/src/Elecciones.Database/Class1.cs
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Elecciones.Database;
|
||||||
|
|
||||||
|
public class Class1
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
{
|
||||||
|
"format": 1,
|
||||||
|
"restore": {
|
||||||
|
"E:\\Elecciones-2025\\Elecciones-Web\\src\\Elecciones.Database\\Elecciones.Database.csproj": {}
|
||||||
|
},
|
||||||
|
"projects": {
|
||||||
|
"E:\\Elecciones-2025\\Elecciones-Web\\src\\Elecciones.Database\\Elecciones.Database.csproj": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"restore": {
|
||||||
|
"projectUniqueName": "E:\\Elecciones-2025\\Elecciones-Web\\src\\Elecciones.Database\\Elecciones.Database.csproj",
|
||||||
|
"projectName": "Elecciones.Database",
|
||||||
|
"projectPath": "E:\\Elecciones-2025\\Elecciones-Web\\src\\Elecciones.Database\\Elecciones.Database.csproj",
|
||||||
|
"packagesPath": "C:\\Users\\dmolinari\\.nuget\\packages\\",
|
||||||
|
"outputPath": "E:\\Elecciones-2025\\Elecciones-Web\\src\\Elecciones.Database\\obj\\",
|
||||||
|
"projectStyle": "PackageReference",
|
||||||
|
"fallbackFolders": [
|
||||||
|
"D:\\Microsoft\\VisualStudio\\Microsoft Visual Studio\\Shared\\NuGetPackages"
|
||||||
|
],
|
||||||
|
"configFilePaths": [
|
||||||
|
"C:\\Users\\dmolinari\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||||
|
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
|
||||||
|
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
||||||
|
],
|
||||||
|
"originalTargetFrameworks": [
|
||||||
|
"net9.0"
|
||||||
|
],
|
||||||
|
"sources": {
|
||||||
|
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||||
|
"https://api.nuget.org/v3/index.json": {}
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"net9.0": {
|
||||||
|
"targetAlias": "net9.0",
|
||||||
|
"projectReferences": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"warningProperties": {
|
||||||
|
"warnAsError": [
|
||||||
|
"NU1605"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"restoreAuditProperties": {
|
||||||
|
"enableAudit": "true",
|
||||||
|
"auditLevel": "low",
|
||||||
|
"auditMode": "direct"
|
||||||
|
},
|
||||||
|
"SdkAnalysisLevel": "9.0.300"
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"net9.0": {
|
||||||
|
"targetAlias": "net9.0",
|
||||||
|
"imports": [
|
||||||
|
"net461",
|
||||||
|
"net462",
|
||||||
|
"net47",
|
||||||
|
"net471",
|
||||||
|
"net472",
|
||||||
|
"net48",
|
||||||
|
"net481"
|
||||||
|
],
|
||||||
|
"assetTargetFallback": true,
|
||||||
|
"warn": true,
|
||||||
|
"frameworkReferences": {
|
||||||
|
"Microsoft.NETCore.App": {
|
||||||
|
"privateAssets": "all"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.300/PortableRuntimeIdentifierGraph.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
|
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
|
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||||
|
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
||||||
|
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
||||||
|
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||||
|
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\dmolinari\.nuget\packages\;D:\Microsoft\VisualStudio\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
|
||||||
|
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||||
|
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.14.0</NuGetToolVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
|
<SourceRoot Include="C:\Users\dmolinari\.nuget\packages\" />
|
||||||
|
<SourceRoot Include="D:\Microsoft\VisualStudio\Microsoft Visual Studio\Shared\NuGetPackages\" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
|
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
||||||
6
Elecciones-Web/src/Elecciones.Infrastructure/Class1.cs
Normal file
6
Elecciones-Web/src/Elecciones.Infrastructure/Class1.cs
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Elecciones.Infrastructure;
|
||||||
|
|
||||||
|
public class Class1
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Elecciones.Core\Elecciones.Core.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
{
|
||||||
|
"format": 1,
|
||||||
|
"restore": {
|
||||||
|
"E:\\Elecciones-2025\\Elecciones-Web\\src\\Elecciones.Infrastructure\\Elecciones.Infrastructure.csproj": {}
|
||||||
|
},
|
||||||
|
"projects": {
|
||||||
|
"E:\\Elecciones-2025\\Elecciones-Web\\src\\Elecciones.Infrastructure\\Elecciones.Infrastructure.csproj": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"restore": {
|
||||||
|
"projectUniqueName": "E:\\Elecciones-2025\\Elecciones-Web\\src\\Elecciones.Infrastructure\\Elecciones.Infrastructure.csproj",
|
||||||
|
"projectName": "Elecciones.Infrastructure",
|
||||||
|
"projectPath": "E:\\Elecciones-2025\\Elecciones-Web\\src\\Elecciones.Infrastructure\\Elecciones.Infrastructure.csproj",
|
||||||
|
"packagesPath": "C:\\Users\\dmolinari\\.nuget\\packages\\",
|
||||||
|
"outputPath": "E:\\Elecciones-2025\\Elecciones-Web\\src\\Elecciones.Infrastructure\\obj\\",
|
||||||
|
"projectStyle": "PackageReference",
|
||||||
|
"fallbackFolders": [
|
||||||
|
"D:\\Microsoft\\VisualStudio\\Microsoft Visual Studio\\Shared\\NuGetPackages"
|
||||||
|
],
|
||||||
|
"configFilePaths": [
|
||||||
|
"C:\\Users\\dmolinari\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||||
|
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
|
||||||
|
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
||||||
|
],
|
||||||
|
"originalTargetFrameworks": [
|
||||||
|
"net9.0"
|
||||||
|
],
|
||||||
|
"sources": {
|
||||||
|
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||||
|
"https://api.nuget.org/v3/index.json": {}
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"net9.0": {
|
||||||
|
"targetAlias": "net9.0",
|
||||||
|
"projectReferences": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"warningProperties": {
|
||||||
|
"warnAsError": [
|
||||||
|
"NU1605"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"restoreAuditProperties": {
|
||||||
|
"enableAudit": "true",
|
||||||
|
"auditLevel": "low",
|
||||||
|
"auditMode": "direct"
|
||||||
|
},
|
||||||
|
"SdkAnalysisLevel": "9.0.300"
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"net9.0": {
|
||||||
|
"targetAlias": "net9.0",
|
||||||
|
"imports": [
|
||||||
|
"net461",
|
||||||
|
"net462",
|
||||||
|
"net47",
|
||||||
|
"net471",
|
||||||
|
"net472",
|
||||||
|
"net48",
|
||||||
|
"net481"
|
||||||
|
],
|
||||||
|
"assetTargetFallback": true,
|
||||||
|
"warn": true,
|
||||||
|
"frameworkReferences": {
|
||||||
|
"Microsoft.NETCore.App": {
|
||||||
|
"privateAssets": "all"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.300/PortableRuntimeIdentifierGraph.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
|
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
|
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||||
|
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
||||||
|
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
||||||
|
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||||
|
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\dmolinari\.nuget\packages\;D:\Microsoft\VisualStudio\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
|
||||||
|
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||||
|
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.14.0</NuGetToolVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
|
<SourceRoot Include="C:\Users\dmolinari\.nuget\packages\" />
|
||||||
|
<SourceRoot Include="D:\Microsoft\VisualStudio\Microsoft Visual Studio\Shared\NuGetPackages\" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
|
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
||||||
24
Elecciones-Web/src/Elecciones.Worker/Dockerfile
Normal file
24
Elecciones-Web/src/Elecciones.Worker/Dockerfile
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# --- Etapa 1: Build ---
|
||||||
|
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
|
||||||
|
WORKDIR /src
|
||||||
|
|
||||||
|
# Copiamos los archivos .csproj para restaurar dependencias
|
||||||
|
COPY ["src/Elecciones.Worker/Elecciones.Worker.csproj", "Elecciones.Worker/"]
|
||||||
|
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.Worker/Elecciones.Worker.csproj"
|
||||||
|
|
||||||
|
# Copiamos el resto del código fuente
|
||||||
|
COPY src/. .
|
||||||
|
|
||||||
|
# Publicamos el worker
|
||||||
|
WORKDIR "/src/Elecciones.Worker"
|
||||||
|
RUN dotnet publish "Elecciones.Worker.csproj" -c Release -o /app/publish
|
||||||
|
|
||||||
|
# --- Etapa 2: Final ---
|
||||||
|
# Usamos la imagen de runtime genérica de .NET, ya que no necesita ASP.NET
|
||||||
|
FROM mcr.microsoft.com/dotnet/runtime:9.0 AS final
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=build /app/publish .
|
||||||
|
ENTRYPOINT ["dotnet", "Elecciones.Worker.dll"]
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk.Worker">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<UserSecretsId>dotnet-Elecciones.Worker-b1c6e5c0-7ebf-4eaf-af95-9386d6883c03</UserSecretsId>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.5" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Elecciones.Infrastructure\Elecciones.Infrastructure.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
7
Elecciones-Web/src/Elecciones.Worker/Program.cs
Normal file
7
Elecciones-Web/src/Elecciones.Worker/Program.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
using Elecciones.Worker;
|
||||||
|
|
||||||
|
var builder = Host.CreateApplicationBuilder(args);
|
||||||
|
builder.Services.AddHostedService<Worker>();
|
||||||
|
|
||||||
|
var host = builder.Build();
|
||||||
|
host.Run();
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||||
|
"profiles": {
|
||||||
|
"Elecciones.Worker": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"environmentVariables": {
|
||||||
|
"DOTNET_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
23
Elecciones-Web/src/Elecciones.Worker/Worker.cs
Normal file
23
Elecciones-Web/src/Elecciones.Worker/Worker.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
namespace Elecciones.Worker;
|
||||||
|
|
||||||
|
public class Worker : BackgroundService
|
||||||
|
{
|
||||||
|
private readonly ILogger<Worker> _logger;
|
||||||
|
|
||||||
|
public Worker(ILogger<Worker> logger)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||||
|
{
|
||||||
|
while (!stoppingToken.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
if (_logger.IsEnabled(LogLevel.Information))
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
|
||||||
|
}
|
||||||
|
await Task.Delay(1000, stoppingToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.Hosting.Lifetime": "Information"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
8
Elecciones-Web/src/Elecciones.Worker/appsettings.json
Normal file
8
Elecciones-Web/src/Elecciones.Worker/appsettings.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.Hosting.Lifetime": "Information"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
{
|
||||||
|
"format": 1,
|
||||||
|
"restore": {
|
||||||
|
"E:\\Elecciones-2025\\Elecciones-Web\\src\\Elecciones.Worker\\Elecciones.Worker.csproj": {}
|
||||||
|
},
|
||||||
|
"projects": {
|
||||||
|
"E:\\Elecciones-2025\\Elecciones-Web\\src\\Elecciones.Worker\\Elecciones.Worker.csproj": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"restore": {
|
||||||
|
"projectUniqueName": "E:\\Elecciones-2025\\Elecciones-Web\\src\\Elecciones.Worker\\Elecciones.Worker.csproj",
|
||||||
|
"projectName": "Elecciones.Worker",
|
||||||
|
"projectPath": "E:\\Elecciones-2025\\Elecciones-Web\\src\\Elecciones.Worker\\Elecciones.Worker.csproj",
|
||||||
|
"packagesPath": "C:\\Users\\dmolinari\\.nuget\\packages\\",
|
||||||
|
"outputPath": "E:\\Elecciones-2025\\Elecciones-Web\\src\\Elecciones.Worker\\obj\\",
|
||||||
|
"projectStyle": "PackageReference",
|
||||||
|
"fallbackFolders": [
|
||||||
|
"D:\\Microsoft\\VisualStudio\\Microsoft Visual Studio\\Shared\\NuGetPackages"
|
||||||
|
],
|
||||||
|
"configFilePaths": [
|
||||||
|
"C:\\Users\\dmolinari\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||||
|
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
|
||||||
|
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
||||||
|
],
|
||||||
|
"originalTargetFrameworks": [
|
||||||
|
"net9.0"
|
||||||
|
],
|
||||||
|
"sources": {
|
||||||
|
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||||
|
"https://api.nuget.org/v3/index.json": {}
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"net9.0": {
|
||||||
|
"targetAlias": "net9.0",
|
||||||
|
"projectReferences": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"warningProperties": {
|
||||||
|
"warnAsError": [
|
||||||
|
"NU1605"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"restoreAuditProperties": {
|
||||||
|
"enableAudit": "true",
|
||||||
|
"auditLevel": "low",
|
||||||
|
"auditMode": "direct"
|
||||||
|
},
|
||||||
|
"SdkAnalysisLevel": "9.0.300"
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"net9.0": {
|
||||||
|
"targetAlias": "net9.0",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Extensions.Hosting": {
|
||||||
|
"target": "Package",
|
||||||
|
"version": "[9.0.5, )"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"imports": [
|
||||||
|
"net461",
|
||||||
|
"net462",
|
||||||
|
"net47",
|
||||||
|
"net471",
|
||||||
|
"net472",
|
||||||
|
"net48",
|
||||||
|
"net481"
|
||||||
|
],
|
||||||
|
"assetTargetFallback": true,
|
||||||
|
"warn": true,
|
||||||
|
"frameworkReferences": {
|
||||||
|
"Microsoft.NETCore.App": {
|
||||||
|
"privateAssets": "all"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.300/PortableRuntimeIdentifierGraph.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
|
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
|
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||||
|
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
||||||
|
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
||||||
|
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||||
|
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\dmolinari\.nuget\packages\;D:\Microsoft\VisualStudio\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
|
||||||
|
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||||
|
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.14.0</NuGetToolVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
|
<SourceRoot Include="C:\Users\dmolinari\.nuget\packages\" />
|
||||||
|
<SourceRoot Include="D:\Microsoft\VisualStudio\Microsoft Visual Studio\Shared\NuGetPackages\" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
|
<Import Project="$(NuGetPackageRoot)microsoft.extensions.configuration.usersecrets\9.0.5\buildTransitive\net8.0\Microsoft.Extensions.Configuration.UserSecrets.props" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.configuration.usersecrets\9.0.5\buildTransitive\net8.0\Microsoft.Extensions.Configuration.UserSecrets.props')" />
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
|
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
|
<Import Project="$(NuGetPackageRoot)microsoft.extensions.options\9.0.5\buildTransitive\net8.0\Microsoft.Extensions.Options.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.options\9.0.5\buildTransitive\net8.0\Microsoft.Extensions.Options.targets')" />
|
||||||
|
<Import Project="$(NuGetPackageRoot)microsoft.extensions.configuration.binder\9.0.5\buildTransitive\netstandard2.0\Microsoft.Extensions.Configuration.Binder.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.configuration.binder\9.0.5\buildTransitive\netstandard2.0\Microsoft.Extensions.Configuration.Binder.targets')" />
|
||||||
|
<Import Project="$(NuGetPackageRoot)microsoft.extensions.logging.abstractions\9.0.5\buildTransitive\net8.0\Microsoft.Extensions.Logging.Abstractions.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.logging.abstractions\9.0.5\buildTransitive\net8.0\Microsoft.Extensions.Logging.Abstractions.targets')" />
|
||||||
|
<Import Project="$(NuGetPackageRoot)microsoft.extensions.configuration.usersecrets\9.0.5\buildTransitive\net8.0\Microsoft.Extensions.Configuration.UserSecrets.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.configuration.usersecrets\9.0.5\buildTransitive\net8.0\Microsoft.Extensions.Configuration.UserSecrets.targets')" />
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
90
Elecciones-Web/src/Elecciones.sln
Normal file
90
Elecciones-Web/src/Elecciones.sln
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.0.31903.59
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elecciones.Api", "Elecciones.Api\Elecciones.Api.csproj", "{6C88D221-9476-40B9-A9D1-3F718BFE2FEF}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elecciones.Worker", "Elecciones.Worker\Elecciones.Worker.csproj", "{871E5551-957F-4FE6-89C7-FB378E88D5C5}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elecciones.Infrastructure", "Elecciones.Infrastructure\Elecciones.Infrastructure.csproj", "{92EC4080-1DE2-4B88-A3CD-DC1B068B1165}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elecciones.Core", "Elecciones.Core\Elecciones.Core.csproj", "{86D78531-CCCB-4DD3-9AB3-3D269F693F9D}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elecciones.Database", "Elecciones.Database\Elecciones.Database.csproj", "{ADC646D8-496D-4D3C-AB51-C603056055F0}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
|
Debug|x86 = Debug|x86
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
Release|x64 = Release|x64
|
||||||
|
Release|x86 = Release|x86
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{6C88D221-9476-40B9-A9D1-3F718BFE2FEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{6C88D221-9476-40B9-A9D1-3F718BFE2FEF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{6C88D221-9476-40B9-A9D1-3F718BFE2FEF}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{6C88D221-9476-40B9-A9D1-3F718BFE2FEF}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{6C88D221-9476-40B9-A9D1-3F718BFE2FEF}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{6C88D221-9476-40B9-A9D1-3F718BFE2FEF}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{6C88D221-9476-40B9-A9D1-3F718BFE2FEF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{6C88D221-9476-40B9-A9D1-3F718BFE2FEF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{6C88D221-9476-40B9-A9D1-3F718BFE2FEF}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{6C88D221-9476-40B9-A9D1-3F718BFE2FEF}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{6C88D221-9476-40B9-A9D1-3F718BFE2FEF}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{6C88D221-9476-40B9-A9D1-3F718BFE2FEF}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{871E5551-957F-4FE6-89C7-FB378E88D5C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{871E5551-957F-4FE6-89C7-FB378E88D5C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{871E5551-957F-4FE6-89C7-FB378E88D5C5}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{871E5551-957F-4FE6-89C7-FB378E88D5C5}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{871E5551-957F-4FE6-89C7-FB378E88D5C5}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{871E5551-957F-4FE6-89C7-FB378E88D5C5}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{871E5551-957F-4FE6-89C7-FB378E88D5C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{871E5551-957F-4FE6-89C7-FB378E88D5C5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{871E5551-957F-4FE6-89C7-FB378E88D5C5}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{871E5551-957F-4FE6-89C7-FB378E88D5C5}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{871E5551-957F-4FE6-89C7-FB378E88D5C5}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{871E5551-957F-4FE6-89C7-FB378E88D5C5}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{92EC4080-1DE2-4B88-A3CD-DC1B068B1165}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{92EC4080-1DE2-4B88-A3CD-DC1B068B1165}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{92EC4080-1DE2-4B88-A3CD-DC1B068B1165}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{92EC4080-1DE2-4B88-A3CD-DC1B068B1165}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{92EC4080-1DE2-4B88-A3CD-DC1B068B1165}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{92EC4080-1DE2-4B88-A3CD-DC1B068B1165}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{92EC4080-1DE2-4B88-A3CD-DC1B068B1165}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{92EC4080-1DE2-4B88-A3CD-DC1B068B1165}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{92EC4080-1DE2-4B88-A3CD-DC1B068B1165}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{92EC4080-1DE2-4B88-A3CD-DC1B068B1165}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{92EC4080-1DE2-4B88-A3CD-DC1B068B1165}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{92EC4080-1DE2-4B88-A3CD-DC1B068B1165}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{86D78531-CCCB-4DD3-9AB3-3D269F693F9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{86D78531-CCCB-4DD3-9AB3-3D269F693F9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{86D78531-CCCB-4DD3-9AB3-3D269F693F9D}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{86D78531-CCCB-4DD3-9AB3-3D269F693F9D}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{86D78531-CCCB-4DD3-9AB3-3D269F693F9D}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{86D78531-CCCB-4DD3-9AB3-3D269F693F9D}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{86D78531-CCCB-4DD3-9AB3-3D269F693F9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{86D78531-CCCB-4DD3-9AB3-3D269F693F9D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{86D78531-CCCB-4DD3-9AB3-3D269F693F9D}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{86D78531-CCCB-4DD3-9AB3-3D269F693F9D}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{86D78531-CCCB-4DD3-9AB3-3D269F693F9D}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{86D78531-CCCB-4DD3-9AB3-3D269F693F9D}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{ADC646D8-496D-4D3C-AB51-C603056055F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{ADC646D8-496D-4D3C-AB51-C603056055F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{ADC646D8-496D-4D3C-AB51-C603056055F0}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{ADC646D8-496D-4D3C-AB51-C603056055F0}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{ADC646D8-496D-4D3C-AB51-C603056055F0}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{ADC646D8-496D-4D3C-AB51-C603056055F0}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{ADC646D8-496D-4D3C-AB51-C603056055F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{ADC646D8-496D-4D3C-AB51-C603056055F0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{ADC646D8-496D-4D3C-AB51-C603056055F0}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{ADC646D8-496D-4D3C-AB51-C603056055F0}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{ADC646D8-496D-4D3C-AB51-C603056055F0}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{ADC646D8-496D-4D3C-AB51-C603056055F0}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
services:
|
||||||
|
# Servicio del Backend API
|
||||||
|
elecciones-api:
|
||||||
|
build:
|
||||||
|
context: ./Elecciones-Web
|
||||||
|
dockerfile: src/Elecciones.Api/Dockerfile
|
||||||
|
container_name: elecciones-api
|
||||||
|
restart: unless-stopped
|
||||||
|
env_file:
|
||||||
|
- ./.env # Lee las variables de entorno desde el archivo .env
|
||||||
|
networks:
|
||||||
|
- elecciones-net
|
||||||
|
- shared-net # Se conecta a la red compartida para hablar con la DB
|
||||||
|
# No se exponen puertos directamente al host. El proxy se encarga.
|
||||||
|
|
||||||
|
# Servicio del Worker para la ingesta de datos
|
||||||
|
elecciones-worker:
|
||||||
|
build:
|
||||||
|
context: ./Elecciones-Web
|
||||||
|
dockerfile: src/Elecciones.Worker/Dockerfile
|
||||||
|
container_name: elecciones-worker
|
||||||
|
restart: unless-stopped
|
||||||
|
env_file:
|
||||||
|
- ./.env
|
||||||
|
networks:
|
||||||
|
- shared-net # Solo necesita acceso a la DB y a la API electoral (internet).
|
||||||
|
# No se exponen puertos.
|
||||||
|
|
||||||
|
# Servicio del Frontend (servido por Nginx)
|
||||||
|
# Lo definimos ahora, aunque lo construiremos más adelante.
|
||||||
|
elecciones-frontend:
|
||||||
|
build:
|
||||||
|
context: ./Elecciones-Web/frontend
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
container_name: elecciones-frontend
|
||||||
|
restart: unless-stopped
|
||||||
|
networks:
|
||||||
|
- elecciones-net
|
||||||
|
# No se exponen puertos.
|
||||||
|
|
||||||
|
# Proxy Inverso que expone los servicios al exterior
|
||||||
|
proxy:
|
||||||
|
image: nginx:1.25-alpine
|
||||||
|
container_name: elecciones-proxy
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
# Mapea nuestro archivo de configuración local al contenedor de Nginx
|
||||||
|
- ./proxy/nginx.conf:/etc/nginx/conf.d/default.conf
|
||||||
|
ports:
|
||||||
|
# ÚNICO PUNTO DE ENTRADA: Expone el puerto 80 del contenedor al puerto 8600 del host.
|
||||||
|
- "8600:80"
|
||||||
|
networks:
|
||||||
|
- elecciones-net
|
||||||
|
depends_on:
|
||||||
|
- elecciones-api
|
||||||
|
- elecciones-frontend
|
||||||
|
|
||||||
|
networks:
|
||||||
|
elecciones-net:
|
||||||
|
driver: bridge
|
||||||
|
|
||||||
|
# Asumimos que la red 'shared-net' ya existe en Docker.
|
||||||
|
# Para crearla manualmente: docker network create shared-net
|
||||||
|
shared-net:
|
||||||
|
external: true
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
# ./proxy/nginx.conf
|
||||||
|
|
||||||
|
# Definimos los upstreams para referirnos a nuestros servicios por su nombre.
|
||||||
|
# Docker Compose se encargará de resolver estos nombres a las IPs de los contenedores.
|
||||||
|
upstream backend_api {
|
||||||
|
# Apunta al servicio de la API en el puerto que expone internamente.
|
||||||
|
# Por defecto, .NET en contenedores usa el 8080.
|
||||||
|
server elecciones-api:8080;
|
||||||
|
}
|
||||||
|
|
||||||
|
upstream frontend_app {
|
||||||
|
# Apunta al contenedor que sirve los archivos estáticos del frontend.
|
||||||
|
# El Dockerfile del frontend usará un Nginx que escucha en el puerto 80.
|
||||||
|
server elecciones-frontend:80;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name _; # Escucha en cualquier hostname que llegue a este proxy.
|
||||||
|
|
||||||
|
# --- UBICACIÓN PARA LA API ---
|
||||||
|
# Gestiona todas las peticiones que comienzan con /api/
|
||||||
|
location /api/ {
|
||||||
|
proxy_pass http://backend_api;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
|
|
||||||
|
# --- UBICACIÓN PARA EL FRONTEND (RAÍZ Y CUALQUIER OTRA RUTA) ---
|
||||||
|
# Gestiona todas las demás peticiones.
|
||||||
|
location / {
|
||||||
|
# ¡CRUCIAL! Añade la cabecera CORS para permitir que los widgets
|
||||||
|
# se incrusten y carguen desde otros dominios como www.eldia.com.
|
||||||
|
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||||
|
|
||||||
|
# Manejo de peticiones pre-vuelo (preflight) OPTIONS.
|
||||||
|
if ($request_method = 'OPTIONS') {
|
||||||
|
add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS';
|
||||||
|
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
|
||||||
|
add_header 'Access-Control-Max-Age' 1728000;
|
||||||
|
add_header 'Content-Type' 'text/plain; charset=utf-8';
|
||||||
|
add_header 'Content-Length' 0;
|
||||||
|
return 204;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Redirige la petición al contenedor del frontend.
|
||||||
|
proxy_pass http://frontend_app;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user