feat: dockerized version

This commit is contained in:
2025-09-02 14:00:24 -06:00
parent 21f5945272
commit 0affc6ebf4
5 changed files with 66 additions and 2 deletions

38
Dockerfile Normal file
View File

@@ -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"]