NewsArchival/NewsArchival.Scraper/Dockerfile

26 lines
858 B
Docker

FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine AS build
WORKDIR /src
# Copy the solution and ALL project files first
COPY NewsArchive.sln ./
COPY nuget.config ./
COPY LocalNuGet/ ./LocalNuGet/
COPY NewsArchive.Api/*.csproj ./NewsArchive.Api/
COPY NewsArchive.Scraper/*.csproj ./NewsArchive.Scraper/
COPY NewsArchive.Core/*.csproj ./NewsArchive.Core/
COPY NewsArchive.UI/*.csproj ./NewsArchive.UI/
# Restore the whole solution - this fixes the missing HtmlAgilityPack/AngleSharp issue
RUN dotnet restore
# Now copy the actual source code
COPY . .
# Build and Publish the Scraper
WORKDIR "/src/NewsArchive.Scraper"
RUN dotnet publish "NewsArchive.Scraper.csproj" -c Release -o /app/publish --no-restore
FROM mcr.microsoft.com/dotnet/aspnet:9.0-alpine AS final
WORKDIR /app
COPY --from=build /app/publish .
ENTRYPOINT ["dotnet", "NewsArchive.Scraper.dll"]