# Use the official Microsoft .NET runtime as the base image (no ASP.NET needed for console worker) FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base WORKDIR /app # Use the official Microsoft .NET SDK image to build the code. FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build WORKDIR /src # Copy project files for dependency restoration COPY ["Managing.Workers/Managing.Workers.csproj", "Managing.Workers/"] COPY ["Managing.Bootstrap/Managing.Bootstrap.csproj", "Managing.Bootstrap/"] COPY ["Managing.Application/Managing.Application.csproj", "Managing.Application/"] COPY ["Managing.Application.Abstractions/Managing.Application.Abstractions.csproj", "Managing.Application.Abstractions/"] COPY ["Managing.Common/Managing.Common.csproj", "Managing.Common/"] COPY ["Managing.Core/Managing.Core.csproj", "Managing.Core/"] COPY ["Managing.Domain/Managing.Domain.csproj", "Managing.Domain/"] COPY ["Managing.Infrastructure.Database/Managing.Infrastructure.Databases.csproj", "Managing.Infrastructure.Database/"] COPY ["Managing.Infrastructure.Exchanges/Managing.Infrastructure.Exchanges.csproj", "Managing.Infrastructure.Exchanges/"] COPY ["Managing.Infrastructure.Messengers/Managing.Infrastructure.Messengers.csproj", "Managing.Infrastructure.Messengers/"] COPY ["Managing.Infrastructure.Storage/Managing.Infrastructure.Storage.csproj", "Managing.Infrastructure.Storage/"] COPY ["Managing.Infrastructure.Web3/Managing.Infrastructure.Evm.csproj", "Managing.Infrastructure.Web3/"] # Restore dependencies for all projects RUN dotnet restore "Managing.Workers/Managing.Workers.csproj" # Copy everything else and build COPY . . WORKDIR "/src/Managing.Workers" RUN dotnet build "Managing.Workers.csproj" -c Release -o /app/build FROM build AS publish RUN dotnet publish "Managing.Workers.csproj" -c Release -o /app/publish FROM base AS final WORKDIR /app COPY --from=publish /app/publish . ENTRYPOINT ["dotnet", "Managing.Workers.dll"]