39 lines
1.1 KiB
Docker
39 lines
1.1 KiB
Docker
# ===== 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"]
|