# StellaOps Timeline Service # Multi-stage build for optimized production image FROM mcr.microsoft.com/dotnet/sdk:10.0-preview AS build WORKDIR /src # Copy solution and project files for restore COPY ["src/Timeline/StellaOps.Timeline.WebService/StellaOps.Timeline.WebService.csproj", "src/Timeline/StellaOps.Timeline.WebService/"] COPY ["src/Timeline/__Libraries/StellaOps.Timeline.Core/StellaOps.Timeline.Core.csproj", "src/Timeline/__Libraries/StellaOps.Timeline.Core/"] COPY ["src/__Libraries/StellaOps.Eventing/StellaOps.Eventing.csproj", "src/__Libraries/StellaOps.Eventing/"] COPY ["src/__Libraries/StellaOps.HybridLogicalClock/StellaOps.HybridLogicalClock.csproj", "src/__Libraries/StellaOps.HybridLogicalClock/"] COPY ["src/__Libraries/StellaOps.Microservice/StellaOps.Microservice.csproj", "src/__Libraries/StellaOps.Microservice/"] COPY ["src/__Libraries/StellaOps.Replay.Core/StellaOps.Replay.Core.csproj", "src/__Libraries/StellaOps.Replay.Core/"] COPY ["nuget.config", "."] COPY ["Directory.Build.props", "."] COPY ["Directory.Packages.props", "."] # Restore dependencies RUN dotnet restore "src/Timeline/StellaOps.Timeline.WebService/StellaOps.Timeline.WebService.csproj" # Copy source code COPY ["src/", "src/"] # Build WORKDIR /src/src/Timeline/StellaOps.Timeline.WebService RUN dotnet build -c Release -o /app/build --no-restore # Publish FROM build AS publish RUN dotnet publish -c Release -o /app/publish --no-build /p:UseAppHost=false # Runtime image FROM mcr.microsoft.com/dotnet/aspnet:10.0-preview AS runtime WORKDIR /app # Create non-root user RUN addgroup --system --gid 1000 stellaops && \ adduser --system --uid 1000 --ingroup stellaops stellaops # Copy published files COPY --from=publish /app/publish . # Set ownership RUN chown -R stellaops:stellaops /app # Switch to non-root user USER stellaops # Environment configuration ENV ASPNETCORE_URLS=http://+:8080 \ ASPNETCORE_ENVIRONMENT=Production \ DOTNET_EnableDiagnostics=0 \ DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false # Health check HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD curl -f http://localhost:8080/health || exit 1 # Expose port EXPOSE 8080 # Entry point ENTRYPOINT ["dotnet", "StellaOps.Timeline.WebService.dll"]