content: FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
  WORKDIR /app
  
  # Copy csproj and restore as distinct layers
  COPY *.csproj ./
  RUN dotnet restore
  
  # Copy everything else and build
  COPY . ./
  RUN dotnet publish -c Release -f net8.0 -o out
  
  # Build runtime image
  FROM mcr.microsoft.com/dotnet/aspnet:8.0
  RUN apt-get update && apt-get install -y curl
  WORKDIR /app
  COPY --from=build /app/out .
  
  # Download the Datadog .NET Tracer
  ARG TRACER_VERSION=3.28.0
  RUN mkdir -p /var/log/datadog
  RUN mkdir -p /opt/datadog
  RUN curl -LO https://github.com/DataDog/dd-trace-dotnet/releases/download/v${TRACER_VERSION}/datadog-dotnet-apm_${TRACER_VERSION}_amd64.deb
  RUN dpkg -i ./datadog-dotnet-apm_${TRACER_VERSION}_amd64.deb
  
  # Set up the Datadog .NET Tracer automatic instrumentation
  ENV CORECLR_ENABLE_PROFILING=1
  ENV CORECLR_PROFILER={846F5F1C-F9AE-4B07-969E-05C26BC060D8}
  ENV CORECLR_PROFILER_PATH=/opt/datadog/Datadog.Trace.ClrProfiler.Native.so
  ENV DD_DOTNET_TRACER_HOME=/opt/datadog
  
  # Set up additional capabilities of the Datadog .NET Tracer
  ENV DD_APPSEC_ENABLED=true
  
  # Enable the OTEL tracing feature flag to receive OTEL spans
  ENV DD_TRACE_OTEL_ENABLED=true
  
  CMD ["dotnet", "OpenTelemetry.AspNetCoreApplication.dll"]