Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions user-management/scripts/target.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
set -e

# Map TARGETPLATFORM to Rust target
case "$TARGETPLATFORM" in

@jeastham1993 jeastham1993 Jun 17, 2025

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pulled directly from your Rust example @scottgerring 🎉

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semi-related: there was an amazing article about the horror of target triples that popped up recently. Worth reading if you want to cry.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naaa, all good for crying thanks :)

"linux/amd64")
export TRACER_ARCHITECTURE="amd64"
;;
"linux/arm64")
export TRACER_ARCHITECTURE="arm64"
;;
*)
echo "Unsupported platform: $TARGETPLATFORM"
exit 1
;;
esac
32 changes: 30 additions & 2 deletions user-management/src/Stickerlandia.UserManagement.Api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
FROM --platform=${BUILDPLATFORM} mcr.microsoft.com/dotnet/sdk:8.0 AS build

ARG TARGETPLATFORM

WORKDIR /App

COPY ./scripts ./scripts

# Download the latest version of the tracer but don't install yet
RUN . scripts/target.sh && curl -Lo /tmp/datadog-dotnet-apm.deb https://github.com/DataDog/dd-trace-dotnet/releases/download/v3.19.0/datadog-dotnet-apm_3.19.0_${TRACER_ARCHITECTURE}.deb

# Deps
COPY src/Stickerlandia.UserManagement.Api/Stickerlandia.UserManagement.Api.csproj src/Stickerlandia.UserManagement.Api/
RUN dotnet restore src/Stickerlandia.UserManagement.Api/Stickerlandia.UserManagement.Api.csproj
Expand All @@ -12,11 +19,32 @@ COPY . ./
# Publish the application
RUN dotnet publish src/Stickerlandia.UserManagement.Api/Stickerlandia.UserManagement.Api.csproj -o out -c Release
Comment thread
scottgerring marked this conversation as resolved.

FROM mcr.microsoft.com/dotnet/aspnet:8.0-noble-chiseled AS runtime
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime

# Copy the tracer from build target
COPY --from=build /tmp/datadog-dotnet-apm.deb /tmp/datadog-dotnet-apm.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

ARG DD_GIT_REPOSITORY_URL
ARG DD_GIT_COMMIT_SHA

ENV DD_GIT_REPOSITORY_URL=${DD_GIT_REPOSITORY_URL}
ENV DD_GIT_COMMIT_SHA=${DD_GIT_COMMIT_SHA}

# These environment variables configure the Datadog .NET Tracer
ENV CORECLR_ENABLE_PROFILING=1
ENV CORECLR_PROFILER={846F5F1C-F9AE-4B07-969E-05C26BC060D8}
Comment thread
jeastham1993 marked this conversation as resolved.
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
ENV DD_LOGS_INJECTION=true
ENV DD_RUNTIME_METRICS_ENABLED=true
ENV DD_PROFILING_ENABLED=1

WORKDIR /App
COPY --from=build /App/out .
EXPOSE 80
Expand Down

This file was deleted.