Skip to content

Commit 3ff8af0

Browse files
[SVLS-7120] Add instructions for using a Github token in .NET Serverless-Init Install Script (DataDog#30567)
Co-authored-by: Michael Cretzman <58786311+michaelcretzman@users.noreply.github.com>
1 parent c3d4b9c commit 3ff8af0

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

layouts/shortcodes/svl-init-dotnet.en.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ Add the following instructions and arguments to your Dockerfile.
33
```dockerfile
44
# For alpine or arm64 builds, refer to the explanation section
55
COPY --from=datadog/serverless-init:1 / /app/
6-
RUN chmod +x /app/dotnet.sh && /app/dotnet.sh
6+
RUN --mount=type=secret,id=github-token,env=GITHUB_TOKEN \
7+
chmod +x /app/dotnet.sh && /app/dotnet.sh
78

89
ENV DD_SERVICE=datadog-demo-run-dotnet
910
ENV DD_ENV=datadog-demo
@@ -19,10 +20,12 @@ CMD ["dotnet", "helloworld.dll"]
1920
COPY --from=datadog/serverless-init:1 / /app/
2021
```
2122

22-
2. Copy the Datadog .NET tracer into your Docker image.
23+
2. Copy the Datadog .NET tracer into your Docker image. If the GitHub requests made by the script are rate limited, pass a GitHub token saved in the environment variable
24+
`GITHUB_TOKEN` as a [Docker build secret][2] `--secret id=github-token,env=GITHUB_TOKEN`.
2325
For linux/amd64, include the following:
2426
```dockerfile
25-
RUN chmod +x /app/dotnet.sh && /app/dotnet.sh
27+
RUN --mount=type=secret,id=github-token,env=GITHUB_TOKEN \
28+
chmod +x /app/dotnet.sh && /app/dotnet.sh
2629
```
2730

2831
For other architecture types, configure your Dockerfile like so:
@@ -60,7 +63,8 @@ If you already have an entrypoint defined inside your Dockerfile, you can instea
6063
```dockerfile
6164
# For alpine or arm64 builds, refer to tracer installation of the explanation section
6265
COPY --from=datadog/serverless-init:1 / /app/
63-
RUN chmod +x /app/dotnet.sh && /app/dotnet.sh
66+
RUN --mount=type=secret,id=github-token,env=GITHUB_TOKEN \
67+
chmod +x /app/dotnet.sh && /app/dotnet.sh
6468

6569
ENV DD_SERVICE=datadog-demo-run-dotnet
6670
ENV DD_ENV=datadog-demo
@@ -73,7 +77,8 @@ If you require your entrypoint to be instrumented as well, you can swap your ent
7377
```dockerfile
7478
# For alpine or arm64 builds, refer to tracer installation of the explanation section
7579
COPY --from=datadog/serverless-init:1 / /app/
76-
RUN chmod +x /app/dotnet.sh && /app/dotnet.sh
80+
RUN --mount=type=secret,id=github-token,env=GITHUB_TOKEN \
81+
chmod +x /app/dotnet.sh && /app/dotnet.sh
7782

7883
ENV DD_SERVICE=datadog-demo-run-dotnet
7984
ENV DD_ENV=datadog-demo
@@ -85,3 +90,4 @@ CMD ["your_entrypoint.sh", "dotnet", "helloworld.dll"]
8590
As long as your command to run is passed as an argument to `datadog-init`, you will receive full instrumentation.
8691

8792
[1]: /tracing/trace_collection/dd_libraries/dotnet-core/?tab=linux#custom-instrumentation
93+
[2]: https://docs.docker.com/build/building/secrets/

0 commit comments

Comments
 (0)