# Stage 1: Runtime FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base WORKDIR /app EXPOSE 8080 # Stage 2: Build FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build WORKDIR /src # Copy both .csproj files to restore dependencies first (better for Docker caching) COPY ["paperless-ngx-export.service/paperless-ngx-export.service.csproj", "paperless-ngx-export.service/"] COPY ["paperless-ngx-export/paperless-ngx-export.csproj", "paperless-ngx-export/"] # Restore only the entry point project (it will automatically restore the dependency) RUN dotnet restore "paperless-ngx-export.service/paperless-ngx-export.service.csproj" # Copy the rest of the source code for both projects COPY . . # Build the service WORKDIR "/src/paperless-ngx-export.service" RUN dotnet build "paperless-ngx-export.service.csproj" -c Release -o /app/build # Stage 3: Publish FROM build AS publish RUN dotnet publish "paperless-ngx-export.service.csproj" -c Release -o /app/publish /p:UseAppHost=false # Stage 4: Final Image FROM base AS final WORKDIR /app COPY --from=publish /app/publish . ENTRYPOINT ["dotnet", "paperless-ngx-export.service.dll"]