build: Configure dotnet restore with --disable-parallel and --verbosity minimal in the Dockerfile.

This commit is contained in:
Ho Ngoc Hai
2026-01-18 02:14:41 +07:00
parent 8fa5e05d2c
commit 933eac0a31

View File

@@ -9,22 +9,31 @@ COPY ["src/AdsTrackingService.Domain/AdsTrackingService.Domain.csproj", "src/Ads
COPY ["src/AdsTrackingService.Infrastructure/AdsTrackingService.Infrastructure.csproj", "src/AdsTrackingService.Infrastructure/"]
COPY ["Directory.Build.props", "./"]
# EN: Restore dependencies
# VI: Khôi phục dependencies
RUN dotnet restore "src/AdsTrackingService.API/AdsTrackingService.API.csproj"
# EN: Restore dependencies with retry and verbose logging
# VI: Khôi phục dependencies với retry và logging chi tiết
RUN dotnet restore "src/AdsTrackingService.API/AdsTrackingService.API.csproj" \
--disable-parallel \
--verbosity minimal
# EN: Copy all source code
# VI: Sao chép toàn bộ source code
# EN: Copy all source code (excluding bin/obj via .dockerignore)
# VI: Sao chép toàn bộ source code (loại trừ bin/obj qua .dockerignore)
COPY src/ ./src/
# EN: Build the application
# VI: Build ứng dụng
WORKDIR "/src/src/AdsTrackingService.API"
RUN dotnet build "AdsTrackingService.API.csproj" -c Release -o /app/build --no-restore
RUN dotnet build "AdsTrackingService.API.csproj" \
-c Release \
-o /app/build \
--no-restore
# Publish stage / Giai đoạn publish
FROM build AS publish
RUN dotnet publish "AdsTrackingService.API.csproj" -c Release -o /app/publish /p:UseAppHost=false --no-restore
RUN dotnet publish "AdsTrackingService.API.csproj" \
-c Release \
-o /app/publish \
/p:UseAppHost=false \
--no-restore
# Runtime stage / Giai đoạn runtime
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS final