# syntax=docker/dockerfile:1.7-labs # Orchestrator Service Dockerfile # Multi-stage build for deterministic, reproducible container images. # Supports air-gapped deployment via digest-pinned base images. ARG SDK_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:10.0 ARG RUNTIME_IMAGE=mcr.microsoft.com/dotnet/nightly/aspnet:10.0 ARG VERSION=0.0.0 ARG CHANNEL=dev ARG GIT_SHA=0000000 ARG SOURCE_DATE_EPOCH=0 # ============================================================================== # Stage 1: Build # ============================================================================== FROM ${SDK_IMAGE} AS build ARG GIT_SHA ARG SOURCE_DATE_EPOCH WORKDIR /src ENV DOTNET_CLI_TELEMETRY_OPTOUT=1 \ DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 \ NUGET_XMLDOC_MODE=skip \ SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} # Copy solution and project files for restore COPY src/Orchestrator/StellaOps.Orchestrator/StellaOps.Orchestrator.sln ./ COPY src/Orchestrator/StellaOps.Orchestrator/StellaOps.Orchestrator.Core/StellaOps.Orchestrator.Core.csproj StellaOps.Orchestrator.Core/ COPY src/Orchestrator/StellaOps.Orchestrator/StellaOps.Orchestrator.Infrastructure/StellaOps.Orchestrator.Infrastructure.csproj StellaOps.Orchestrator.Infrastructure/ COPY src/Orchestrator/StellaOps.Orchestrator/StellaOps.Orchestrator.WebService/StellaOps.Orchestrator.WebService.csproj StellaOps.Orchestrator.WebService/ COPY src/Orchestrator/StellaOps.Orchestrator/StellaOps.Orchestrator.Worker/StellaOps.Orchestrator.Worker.csproj StellaOps.Orchestrator.Worker/ COPY Directory.Build.props Directory.Packages.props ./ # Restore dependencies with cache mount RUN --mount=type=cache,target=/root/.nuget/packages \ dotnet restore StellaOps.Orchestrator.sln # Copy source files COPY src/Orchestrator/StellaOps.Orchestrator/ ./ # Publish WebService RUN --mount=type=cache,target=/root/.nuget/packages \ dotnet publish StellaOps.Orchestrator.WebService/StellaOps.Orchestrator.WebService.csproj \ -c Release \ -o /app/publish/webservice \ /p:UseAppHost=false \ /p:ContinuousIntegrationBuild=true \ /p:SourceRevisionId=${GIT_SHA} \ /p:Deterministic=true \ /p:TreatWarningsAsErrors=true # Publish Worker (optional, for hybrid deployments) RUN --mount=type=cache,target=/root/.nuget/packages \ dotnet publish StellaOps.Orchestrator.Worker/StellaOps.Orchestrator.Worker.csproj \ -c Release \ -o /app/publish/worker \ /p:UseAppHost=false \ /p:ContinuousIntegrationBuild=true \ /p:SourceRevisionId=${GIT_SHA} \ /p:Deterministic=true \ /p:TreatWarningsAsErrors=true # ============================================================================== # Stage 2: Runtime (WebService) # ============================================================================== FROM ${RUNTIME_IMAGE} AS orchestrator-web WORKDIR /app ARG VERSION ARG CHANNEL ARG GIT_SHA ENV DOTNET_EnableDiagnostics=0 \ ASPNETCORE_URLS=http://0.0.0.0:8080 \ ASPNETCORE_ENVIRONMENT=Production \ ORCHESTRATOR__TELEMETRY__MINIMUMLOGLEVEL=Information COPY --from=build /app/publish/webservice/ ./ # Health check endpoints HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ CMD wget --no-verbose --tries=1 --spider http://localhost:8080/healthz || exit 1 EXPOSE 8080 LABEL org.opencontainers.image.title="StellaOps Orchestrator WebService" \ org.opencontainers.image.description="Job scheduling, DAG planning, and worker coordination service" \ org.opencontainers.image.version="${VERSION}" \ org.opencontainers.image.revision="${GIT_SHA}" \ org.opencontainers.image.source="https://git.stella-ops.org/stella-ops/stellaops" \ org.opencontainers.image.vendor="StellaOps" \ org.opencontainers.image.licenses="AGPL-3.0-or-later" \ org.stellaops.release.channel="${CHANNEL}" \ org.stellaops.component="orchestrator-web" ENTRYPOINT ["dotnet", "StellaOps.Orchestrator.WebService.dll"] # ============================================================================== # Stage 3: Runtime (Worker) # ============================================================================== FROM ${RUNTIME_IMAGE} AS orchestrator-worker WORKDIR /app ARG VERSION ARG CHANNEL ARG GIT_SHA ENV DOTNET_EnableDiagnostics=0 \ ASPNETCORE_ENVIRONMENT=Production \ ORCHESTRATOR__TELEMETRY__MINIMUMLOGLEVEL=Information COPY --from=build /app/publish/worker/ ./ LABEL org.opencontainers.image.title="StellaOps Orchestrator Worker" \ org.opencontainers.image.description="Background worker for job execution and orchestration tasks" \ org.opencontainers.image.version="${VERSION}" \ org.opencontainers.image.revision="${GIT_SHA}" \ org.opencontainers.image.source="https://git.stella-ops.org/stella-ops/stellaops" \ org.opencontainers.image.vendor="StellaOps" \ org.opencontainers.image.licenses="AGPL-3.0-or-later" \ org.stellaops.release.channel="${CHANNEL}" \ org.stellaops.component="orchestrator-worker" ENTRYPOINT ["dotnet", "StellaOps.Orchestrator.Worker.dll"]