Simplify Dockerfile: use dotnet nuget add source API
Replaced manual NuGet.Config creation (20 lines) with simple API call (1 line): - dotnet nuget add source for custom Gitea feed - No API key needed for public read access - Much cleaner and more maintainable 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
107739f94b
commit
08dd95a986
@ -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 '<?xml version="1.0" encoding="utf-8"?>' > /root/.nuget/NuGet/NuGet.Config && \
|
||||
echo '<configuration>' >> /root/.nuget/NuGet/NuGet.Config && \
|
||||
echo ' <packageSources>' >> /root/.nuget/NuGet/NuGet.Config && \
|
||||
echo ' <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />' >> /root/.nuget/NuGet/NuGet.Config && \
|
||||
echo ' <add key="musk.fun.nocr" value="https://gitea.musk.fun/api/packages/nocr/nuget/index.json" />' >> /root/.nuget/NuGet/NuGet.Config && \
|
||||
echo ' </packageSources>' >> /root/.nuget/NuGet/NuGet.Config && \
|
||||
echo ' <packageSourceMapping>' >> /root/.nuget/NuGet/NuGet.Config && \
|
||||
echo ' <packageSource key="musk.fun.nocr">' >> /root/.nuget/NuGet/NuGet.Config && \
|
||||
echo ' <package pattern="Nocr.*" />' >> /root/.nuget/NuGet/NuGet.Config && \
|
||||
echo ' </packageSource>' >> /root/.nuget/NuGet/NuGet.Config && \
|
||||
echo ' <packageSource key="nuget.org">' >> /root/.nuget/NuGet/NuGet.Config && \
|
||||
echo ' <package pattern="*" />' >> /root/.nuget/NuGet/NuGet.Config && \
|
||||
echo ' </packageSource>' >> /root/.nuget/NuGet/NuGet.Config && \
|
||||
echo ' </packageSourceMapping>' >> /root/.nuget/NuGet/NuGet.Config && \
|
||||
echo '</configuration>' >> /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.TelegramListener.Host/Nocr.TelegramListener.Host.csproj" --verbosity normal
|
||||
WORKDIR "/src/src/Nocr.TelegramListener.Host"
|
||||
RUN dotnet build "Nocr.TelegramListener.Host.csproj" -c Release -o /app/build
|
||||
|
||||
Loading…
Reference in New Issue
Block a user