40 lines
1.4 KiB
Docker
40 lines
1.4 KiB
Docker
# ============ 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"]
|