users/src/Nocr.Users.Host/Dockerfile
ruberoid a2750a154c Simplify Dockerfiles: use dotnet nuget add source API
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 <noreply@anthropic.com>
2025-10-14 15:00:26 +04:00

32 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.Users.Host/Nocr.Users.Host.csproj" --verbosity normal
WORKDIR "/src/src/Nocr.Users.Host"
RUN dotnet build "Nocr.Users.Host.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Nocr.Users.Host.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Nocr.Users.Host.dll"]