From af5118964001bcdaddb4798096d811f71806ccf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20White?= Date: Mon, 1 Sep 2025 10:19:45 -0600 Subject: [PATCH] devops: added dockerfile and other configs --- .dockerignore | 12 +++++++ .../Core.Inventory.DAL.API.csproj | 2 +- .../Core.Inventory.Domain.csproj | 2 +- .../Core.Inventory.Provider.csproj | 4 +-- Dockerfile | 32 +++++++++++++++++++ nuget.config | 9 ++++++ 6 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 nuget.config diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..4971510 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,12 @@ +**/bin +**/obj +**/out +**/.vs +**/.idea +**/.git +**/.gitignore +**/node_modules +*.user +*.swp +*.swo +.DS_Store diff --git a/Core.Inventory.DAL.API/Core.Inventory.DAL.API.csproj b/Core.Inventory.DAL.API/Core.Inventory.DAL.API.csproj index 4d7f5c3..ee8c4a5 100644 --- a/Core.Inventory.DAL.API/Core.Inventory.DAL.API.csproj +++ b/Core.Inventory.DAL.API/Core.Inventory.DAL.API.csproj @@ -8,7 +8,7 @@ - + diff --git a/Core.Inventory.Domain/Core.Inventory.Domain.csproj b/Core.Inventory.Domain/Core.Inventory.Domain.csproj index 08eec88..f362f9f 100644 --- a/Core.Inventory.Domain/Core.Inventory.Domain.csproj +++ b/Core.Inventory.Domain/Core.Inventory.Domain.csproj @@ -7,7 +7,7 @@ - + diff --git a/Core.Inventory.Provider/Core.Inventory.Provider.csproj b/Core.Inventory.Provider/Core.Inventory.Provider.csproj index 7d293f8..5b9224c 100644 --- a/Core.Inventory.Provider/Core.Inventory.Provider.csproj +++ b/Core.Inventory.Provider/Core.Inventory.Provider.csproj @@ -7,9 +7,9 @@ - + - + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e706267 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,32 @@ +# ===== Build stage ===== +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +WORKDIR /src + +# Copia nuget.config de la raíz (con BaGet + nuget.org) +COPY nuget.config ./ + +# Copia SOLO los .csproj que DAL necesita (para cache de restore) +COPY Core.Inventory.DAL.API/Core.Inventory.DAL.API.csproj Core.Inventory.DAL.API/ +COPY Core.Inventory.Domain/Core.Inventory.Domain.csproj Core.Inventory.Domain/ +COPY Core.Inventory.Provider/Core.Inventory.Provider.csproj Core.Inventory.Provider/ + +# Restaura usando nuget.config +RUN dotnet restore Core.Inventory.DAL.API/Core.Inventory.DAL.API.csproj --configfile ./nuget.config + +# Copia el resto del código +COPY . . + +# Publica artefactos listos para runtime +RUN dotnet publish Core.Inventory.DAL.API/Core.Inventory.DAL.API.csproj \ + -c Release -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 . + +# Configuración básica +ENV ASPNETCORE_URLS=http://+:8080 +EXPOSE 8080 + +ENTRYPOINT ["dotnet", "Core.Inventory.DAL.API.dll"] diff --git a/nuget.config b/nuget.config new file mode 100644 index 0000000..c4407da --- /dev/null +++ b/nuget.config @@ -0,0 +1,9 @@ + + + + + + + + +