Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jaycdave88/c28baffab0019224223e8fc19e10b307 to your computer and use it in GitHub Desktop.
Save jaycdave88/c28baffab0019224223e8fc19e10b307 to your computer and use it in GitHub Desktop.
Datadog .NET Core Dockerfile
FROM 415971912945.dkr.ecr.us-west-2.amazonaws.com/aspnet:3.1
RUN apt-get update
RUN apt-get install zip -y
# BUILD TIME ARGUMENTS
ARG SERVICE_NAME
COPY ./extract/ /app/
WORKDIR /app
# ADD entrypoint.sh
COPY entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh
# Setup of Datadog .NET Core APM
# Download the latest version of the tracer but don't install yet
RUN TRACER_VERSION=$(curl -s \https://api.github.com/repos/DataDog/dd-trace-dotnet/releases/latest | grep tag_name | cut -d '"' -f 4 | cut -c2-) \
&& curl -Lo /tmp/datadog-dotnet-apm.deb https://github.com/DataDog/dd-trace-dotnet/releases/download/v${TRACER_VERSION}/datadog-dotnet-apm_${TRACER_VERSION}_amd64.deb
# Install the tracer
RUN mkdir -p /opt/datadog \
&& mkdir -p /var/log/datadog \
&& dpkg -i /tmp/datadog-dotnet-apm.deb \
&& rm /tmp/datadog-dotnet-apm.deb
# Enable the tracer
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
ENV DD_INTEGRATIONS=/opt/datadog/integrations.json
ENTRYPOINT ["/app/entrypoint.sh"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment