From 0affc6ebf488a023d4e123c927fb323021a7d87f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20White?= Date: Tue, 2 Sep 2025 14:00:24 -0600 Subject: [PATCH] feat: dockerized version --- .dockerignore | 17 +++++++++ .../Core.Thalos.BFF.Api.csproj | 2 +- .../Core.Thalos.External.csproj | 2 +- Dockerfile | 38 +++++++++++++++++++ nuget.config | 9 +++++ 5 files changed, 66 insertions(+), 2 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..8d8479a --- /dev/null +++ b/.dockerignore @@ -0,0 +1,17 @@ +**/bin/ +**/obj/ +**/.vs/ +**/.idea/ +**/.vscode/ +**/*.user +**/*.suo +**/*.swp +**/*.csproj.user +**/*.log +**/Properties/launchSettings.json +**/appsettings.Local.json +**/appsettings.*.Development.json +.git/ +.gitignore +Dockerfile +docker-compose*.yml diff --git a/Core.Thalos.BFF.Api/Core.Thalos.BFF.Api.csproj b/Core.Thalos.BFF.Api/Core.Thalos.BFF.Api.csproj index ead983c..9d06f39 100644 --- a/Core.Thalos.BFF.Api/Core.Thalos.BFF.Api.csproj +++ b/Core.Thalos.BFF.Api/Core.Thalos.BFF.Api.csproj @@ -9,7 +9,7 @@ - + diff --git a/Core.Thalos.External/Core.Thalos.External.csproj b/Core.Thalos.External/Core.Thalos.External.csproj index 6cec2c0..aab67ea 100644 --- a/Core.Thalos.External/Core.Thalos.External.csproj +++ b/Core.Thalos.External/Core.Thalos.External.csproj @@ -7,7 +7,7 @@ - + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4aa09bc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,38 @@ +# ============ Build ============ +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +WORKDIR /src + +# (opcional) si tienes nuget.config +COPY nuget.config* ./ + +# Cache de restore por proyecto +COPY Core.Thalos.External/Core.Thalos.External.csproj Core.Thalos.External/ +COPY Core.Thalos.BFF.Api/Core.Thalos.BFF.Api.csproj Core.Thalos.BFF.Api/ + +RUN dotnet restore Core.Thalos.BFF.Api/Core.Thalos.BFF.Api.csproj + +# Copia del resto + build +COPY . . +RUN dotnet build Core.Thalos.BFF.Api/Core.Thalos.BFF.Api.csproj -c Release -o /app/build + +# ============ Publish ============ +FROM build AS publish +RUN dotnet publish Core.Thalos.BFF.Api/Core.Thalos.BFF.Api.csproj -c Release -o /app/publish --no-restore + +# ============ Runtime ============ +FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS final +# curl (opcional) si luego cambias a healthcheck HTTP +RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/* + +WORKDIR /app +EXPOSE 8080 + +# Usuario no-root +RUN useradd -m appuser +USER appuser + +ENV ASPNETCORE_URLS=http://+:8080 +# La app agrega UserSecrets/ENV/KeyVault/Auth en runtime (no hornear secretos). :contentReference[oaicite:9]{index=9} + +COPY --from=publish /app/publish ./ +ENTRYPOINT ["dotnet", "Core.Thalos.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 @@ + + + + + + + + +