devops: added dockerfile and other configs

This commit is contained in:
2025-09-01 10:18:35 -06:00
parent 1c193b68bb
commit 6ec76fc975
5 changed files with 62 additions and 3 deletions

12
.dockerignore Normal file
View File

@@ -0,0 +1,12 @@
**/bin
**/obj
**/out
**/.vs
**/.idea
**/.git
**/.gitignore
**/node_modules
*.user
*.swp
*.swo
.DS_Store

View File

@@ -8,7 +8,7 @@
<ItemGroup>
<PackageReference Include="Asp.Versioning.Mvc.ApiExplorer" Version="8.1.0" />
<PackageReference Include="Core.Blueprint.Logging" Version="1.0.1" />
<PackageReference Include="Core.Blueprint.Logging" Version="1.0.0" />
<PackageReference Include="OpenTelemetry" Version="1.12.0" />
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.12.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="8.1.4" />

View File

@@ -7,8 +7,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Adapters.Lib" Version="1.0.13" />
<PackageReference Include="BuildingBlocks.Library" Version="1.0.0" />
<PackageReference Include="Core.Adapters.Lib" Version="1.0.0" />
<PackageReference Include="Lib.Architecture.BuildingBlocks" Version="1.0.0" />
<PackageReference Include="Refit" Version="8.0.0" />
</ItemGroup>

38
Dockerfile Normal file
View File

@@ -0,0 +1,38 @@
# ===== Build stage =====
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
# Usar tu feed (BaGet) + nuget.org
COPY nuget.config ./
# Copiar SOLO los .csproj primero (mejor caché)
COPY Core.Inventory.BFF.API/Core.Inventory.BFF.API.csproj Core.Inventory.BFF.API/
COPY Core.Inventory.External/Core.Inventory.External.csproj Core.Inventory.External/
# Restore con tu nuget.config
RUN dotnet restore Core.Inventory.BFF.API/Core.Inventory.BFF.API.csproj --configfile ./nuget.config
# Copiar el resto del código
COPY . .
# Publicar artefactos
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish Core.Inventory.BFF.API/Core.Inventory.BFF.API.csproj \
-c $BUILD_CONFIGURATION -o /app/out /p:UseAppHost=false
# ===== Runtime stage =====
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
WORKDIR /app
COPY --from=build /app/out .
# Config base
ENV ASPNETCORE_URLS=http://+:8080 \
ASPNETCORE_ENVIRONMENT=Production
EXPOSE 8080
# (Opcional) Healthcheck si tienes endpoint /health
# HEALTHCHECK --interval=30s --timeout=5s --retries=5 \
# CMD wget -qO- http://localhost:8080/health || exit 1
ENTRYPOINT ["dotnet", "Core.Inventory.BFF.API.dll"]

9
nuget.config Normal file
View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!-- Tu BaGet primero -->
<add key="BaGet" value="https://nuget.dream-views.com/v3/index.json" protocolVersion="3" />
<!-- NuGet oficial como fallback (si quieres) -->
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>