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.External/Core.Thalos.External.csproj b/Core.Thalos.External/Core.Thalos.External.csproj index f20e869..6829b47 100644 --- a/Core.Thalos.External/Core.Thalos.External.csproj +++ b/Core.Thalos.External/Core.Thalos.External.csproj @@ -7,9 +7,9 @@ - - - + + + diff --git a/Core.Thalos.Service.API/Core.Thalos.Service.API.csproj b/Core.Thalos.Service.API/Core.Thalos.Service.API.csproj index da6fda7..d08913a 100644 --- a/Core.Thalos.Service.API/Core.Thalos.Service.API.csproj +++ b/Core.Thalos.Service.API/Core.Thalos.Service.API.csproj @@ -8,7 +8,7 @@ - + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3dd8065 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,39 @@ +# ============ Build ============ +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +WORKDIR /src + +# (Opcional) si usas nuget.config en el root +COPY nuget.config* ./ + +# Copiamos csprojs primero para cachear restore +COPY Core.Thalos.Application/Core.Thalos.Application.csproj Core.Thalos.Application/ +COPY Core.Thalos.External/Core.Thalos.External.csproj Core.Thalos.External/ +COPY Core.Thalos.Service.API/Core.Thalos.Service.API.csproj Core.Thalos.Service.API/ + +RUN dotnet restore Core.Thalos.Service.API/Core.Thalos.Service.API.csproj + +# Copia del resto y build +COPY . . +RUN dotnet build Core.Thalos.Service.API/Core.Thalos.Service.API.csproj -c Release -o /app/build + +# ============ Publish ============ +FROM build AS publish +RUN dotnet publish Core.Thalos.Service.API/Core.Thalos.Service.API.csproj -c Release -o /app/publish --no-restore + +# ============ Runtime ============ +FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS final +# (Opcional) curl para 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 usa UserSecrets y EnvironmentVariables (no metas secretos en la imagen). :contentReference[oaicite:4]{index=4} +COPY --from=publish /app/publish ./ +ENTRYPOINT ["dotnet", "Core.Thalos.Service.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 @@ + + + + + + + + +