question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Alpine dockerfile example

See original GitHub issue

Is your feature request related to a problem? Please describe. No problem. just wanted to showcase my setup if someone finds it useful

Dockerfile


FROM mcr.microsoft.com/dotnet/core/sdk:2.2.401-alpine3.9 AS build-env
WORKDIR /app/src
COPY src/ /app/src/
RUN dotnet publish -o temp -c Release

FROM mcr.microsoft.com/dotnet/core/aspnet:2.2.6-alpine3.9
ENV DD_APM_VERSION=1.9.0
RUN apk --no-cache update \
  && apk add bash make python py-pip libc6-compat gcompat curl
RUN pip install pyyaml
COPY Makefile /app/src/
COPY ./values/*.yaml /app/src/values/
COPY script/parseEnv.py /app/src/script/
COPY --from=build-env app/src/temp /app/src
#Install Datadog APM package
RUN  mkdir -p /opt/datadog
RUN curl -L https://github.com/DataDog/dd-trace-dotnet/releases/download/v${DD_APM_VERSION}/datadog-dotnet-apm-${DD_APM_VERSION}.tar.gz \
  |  tar xzf - -C /opt/datadog
#Setup Datadog APM
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_INTEGRATIONS=/opt/datadog/integrations.json
ENV DD_DOTNET_TRACER_HOME=/opt/datadog
WORKDIR /app/src
CMD ["dotnet", "app.dll"]

app.csproj

 <PackageReference Include="Datadog.Trace.ClrProfiler.Managed" Version="1.9.0" />

in startup class

  private static void ConfigureDataDogAPM()
    {
      var settings = TracerSettings.FromDefaultSources();
      string appName = Environment.GetEnvironmentVariable("APP_NAME");
      settings.ServiceName = appName;
      settings.AgentUri = new Uri("http://localhost:8126/");
      // disable the AdoNet integration
      settings.Integrations["AdoNet"].Enabled = false;
settings.Environment = Environment.GetEnvironmentVariable("ENVIRONMENT");

      // create a new Tracer using these settings
      var tracer = new Tracer(settings);
      // set the global tracer
      Tracer.Instance = tracer;

    }

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
lucaspimentelcommented, Nov 19, 2019

Thanks, @shavo007! This will certainly help others setting up the Tracer on Alpine 3.9.

One bit of feedback: Since v1.8.0, if the DD_DOTNET_TRACER_HOME environment is set, the Datadog.Trace.ClrProfiler.Managed NuGet package is no longer required for .NET Core users, so feel free to remove the <PackageReference> from the csproj project file.

1reaction
colin-higginscommented, Nov 25, 2019

@shavo007 That is correct.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Use the Alpine Docker Official Image
The fastest method involves running docker pull alpine from your terminal. This grabs the alpine:latest image (the most current available version) from Docker ......
Read more >
Use Docker and Alpine Linux to build lightweight containers
In this Docker and Alpine Linux tutorial, learn how to create a lightweight container ... To add Bash to the Dockerfile, use apk...
Read more >
alpine - Official Image
A minimal Docker image based on Alpine Linux with a complete package index and only 5 MB in size!
Read more >
Dockerfile tutorial by example - basics and best practices [2018]
An in-depth tutorial on creating your own Docker images with Dockerfile. Detailed examples, videos and Dockerfile best practices.
Read more >
docker-alpine/docs/usage.md at master
Here is a full example Dockerfile that installs the Python runtime and some build dependencies: FROM gliderlabs/alpine:3.3 RUN apk add --update-cache ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found