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.BFF.API/Core.Inventory.BFF.API.csproj b/Core.Inventory.BFF.API/Core.Inventory.BFF.API.csproj index ceb7811..c18bb8a 100644 --- a/Core.Inventory.BFF.API/Core.Inventory.BFF.API.csproj +++ b/Core.Inventory.BFF.API/Core.Inventory.BFF.API.csproj @@ -8,7 +8,7 @@ - + diff --git a/Core.Inventory.External/Core.Inventory.External.csproj b/Core.Inventory.External/Core.Inventory.External.csproj index 2c5fc6b..0c98b32 100644 --- a/Core.Inventory.External/Core.Inventory.External.csproj +++ b/Core.Inventory.External/Core.Inventory.External.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..06d86e1 --- /dev/null +++ b/Dockerfile @@ -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"] diff --git a/nuget.config b/nuget.config new file mode 100644 index 0000000..c4407da --- /dev/null +++ b/nuget.config @@ -0,0 +1,9 @@ + + + + + + + + +