From 5045e0826efeec5baebc58cff949bf171a6071d4 Mon Sep 17 00:00:00 2001 From: ruberoid Date: Tue, 14 Oct 2025 15:00:19 +0400 Subject: [PATCH] Simplify Dockerfiles: use dotnet nuget add source API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaced manual NuGet.Config creation with simple API call: - Applied to both Host and Migrator Dockerfiles - Reduced from 20+ lines to 1 line per config - No API key needed for public read access 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/Nocr.TextMatcher.Host/Dockerfile | 21 +++------------------ src/Nocr.TextMatcher.Migrator/Dockerfile | 21 +++------------------ 2 files changed, 6 insertions(+), 36 deletions(-) diff --git a/src/Nocr.TextMatcher.Host/Dockerfile b/src/Nocr.TextMatcher.Host/Dockerfile index 2c263f7..9c1dd37 100644 --- a/src/Nocr.TextMatcher.Host/Dockerfile +++ b/src/Nocr.TextMatcher.Host/Dockerfile @@ -16,25 +16,10 @@ RUN apt-get update && \ COPY . . -# Create NuGet.Config with package source mapping to avoid NU1507 warnings -RUN mkdir -p /root/.nuget/NuGet && \ - echo '' > /root/.nuget/NuGet/NuGet.Config && \ - echo '' >> /root/.nuget/NuGet/NuGet.Config && \ - echo ' ' >> /root/.nuget/NuGet/NuGet.Config && \ - echo ' ' >> /root/.nuget/NuGet/NuGet.Config && \ - echo ' ' >> /root/.nuget/NuGet/NuGet.Config && \ - echo ' ' >> /root/.nuget/NuGet/NuGet.Config && \ - echo ' ' >> /root/.nuget/NuGet/NuGet.Config && \ - echo ' ' >> /root/.nuget/NuGet/NuGet.Config && \ - echo ' ' >> /root/.nuget/NuGet/NuGet.Config && \ - echo ' ' >> /root/.nuget/NuGet/NuGet.Config && \ - echo ' ' >> /root/.nuget/NuGet/NuGet.Config && \ - echo ' ' >> /root/.nuget/NuGet/NuGet.Config && \ - echo ' ' >> /root/.nuget/NuGet/NuGet.Config && \ - echo ' ' >> /root/.nuget/NuGet/NuGet.Config && \ - echo '' >> /root/.nuget/NuGet/NuGet.Config +# Add custom NuGet source (no API key needed for public read access) +RUN dotnet nuget add source https://gitea.musk.fun/api/packages/nocr/nuget/index.json --name musk -# Restore with verbose logging to see what's happening +# Restore with verbose logging RUN dotnet restore "src/Nocr.TextMatcher.Host/Nocr.TextMatcher.Host.csproj" --verbosity normal WORKDIR "/src/src/Nocr.TextMatcher.Host" RUN dotnet build "Nocr.TextMatcher.Host.csproj" -c Release -o /app/build diff --git a/src/Nocr.TextMatcher.Migrator/Dockerfile b/src/Nocr.TextMatcher.Migrator/Dockerfile index 416b317..542f233 100644 --- a/src/Nocr.TextMatcher.Migrator/Dockerfile +++ b/src/Nocr.TextMatcher.Migrator/Dockerfile @@ -15,25 +15,10 @@ RUN apt-get update && \ COPY . . -# Create NuGet.Config with package source mapping to avoid NU1507 warnings -RUN mkdir -p /root/.nuget/NuGet && \ - echo '' > /root/.nuget/NuGet/NuGet.Config && \ - echo '' >> /root/.nuget/NuGet/NuGet.Config && \ - echo ' ' >> /root/.nuget/NuGet/NuGet.Config && \ - echo ' ' >> /root/.nuget/NuGet/NuGet.Config && \ - echo ' ' >> /root/.nuget/NuGet/NuGet.Config && \ - echo ' ' >> /root/.nuget/NuGet/NuGet.Config && \ - echo ' ' >> /root/.nuget/NuGet/NuGet.Config && \ - echo ' ' >> /root/.nuget/NuGet/NuGet.Config && \ - echo ' ' >> /root/.nuget/NuGet/NuGet.Config && \ - echo ' ' >> /root/.nuget/NuGet/NuGet.Config && \ - echo ' ' >> /root/.nuget/NuGet/NuGet.Config && \ - echo ' ' >> /root/.nuget/NuGet/NuGet.Config && \ - echo ' ' >> /root/.nuget/NuGet/NuGet.Config && \ - echo ' ' >> /root/.nuget/NuGet/NuGet.Config && \ - echo '' >> /root/.nuget/NuGet/NuGet.Config +# Add custom NuGet source (no API key needed for public read access) +RUN dotnet nuget add source https://gitea.musk.fun/api/packages/nocr/nuget/index.json --name musk -# Restore with verbose logging to see what's happening +# Restore with verbose logging RUN dotnet restore "src/Nocr.TextMatcher.Migrator/Nocr.TextMatcher.Migrator.csproj" --verbosity normal WORKDIR "/src/src/Nocr.TextMatcher.Migrator" RUN dotnet build "Nocr.TextMatcher.Migrator.csproj" -c Release -o /app/build