# Multi-stage build for the Event Subscriber service (.NET 10). # Build context is services/event-subscriber, but it references the shared read model in # services/projection-api, so the context is the repo root (see infra/docker-compose.yml). FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build WORKDIR /src # Restore first (cached unless .csproj files change). COPY services/event-subscriber/EventSubscriber.Api/EventSubscriber.Api.csproj services/event-subscriber/EventSubscriber.Api/ COPY services/event-subscriber/EventSubscriber.Application/EventSubscriber.Application.csproj services/event-subscriber/EventSubscriber.Application/ COPY services/projection-api/Projection.ReadModel/Projection.ReadModel.csproj services/projection-api/Projection.ReadModel/ RUN dotnet restore services/event-subscriber/EventSubscriber.Api/EventSubscriber.Api.csproj COPY services/event-subscriber/ services/event-subscriber/ COPY services/projection-api/Projection.ReadModel/ services/projection-api/Projection.ReadModel/ RUN dotnet publish services/event-subscriber/EventSubscriber.Api/EventSubscriber.Api.csproj -c Release -o /app/publish /p:UseAppHost=false FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime WORKDIR /app RUN apt-get update \ && apt-get install -y --no-install-recommends curl \ && rm -rf /var/lib/apt/lists/* COPY --from=build /app/publish . ENV ASPNETCORE_URLS=http://+:8080 EXPOSE 8080 HEALTHCHECK --interval=5s --timeout=3s --start-period=15s --retries=5 \ CMD curl -fsS http://localhost:8080/health || exit 1 ENTRYPOINT ["dotnet", "EventSubscriber.Api.dll"]