telegram-client/src/Nocr.TelegramClient.Host/Dockerfile
ruberoid db7b973182 Simplify Dockerfile: use dotnet nuget add source API
Replaced manual NuGet.Config creation with simple API call:
- Reduced from 20+ lines to 1 line
- 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>
2025-10-14 15:00:32 +04:00

33 lines
1.1 KiB
Docker

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
RUN apt-get update && apt-get install -y ca-certificates && update-ca-certificates
RUN apt-get install -y curl && rm -rf /var/lib/apt/lists/*
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
# Install and update CA certificates FIRST before any network operations
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates && \
update-ca-certificates && \
rm -rf /var/lib/apt/lists/*
COPY . .
# 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
RUN dotnet restore "src/Nocr.TelegramClient.Host/Nocr.TelegramClient.Host.csproj" --verbosity normal
WORKDIR "/src/src/Nocr.TelegramClient.Host"
RUN dotnet build "Nocr.TelegramClient.Host.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Nocr.TelegramClient.Host.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Nocr.TelegramClient.Host.dll"]