Last active
March 6, 2025 08:50
-
-
Save codefromthecrypt/7675a865a28e104bf0c72b60b1c4ee04 to your computer and use it in GitHub Desktop.
Elastic Distribution of OpenTelemetry (EDOT) .NET Automatic Instrumentation in Docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ARG DOTNET_VERSION=9.0 | |
FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION}-alpine AS edot | |
ARG EDOT_VERSION=1.0.0-beta.1 | |
ARG EDOT_INSTALL=https://github.com/elastic/elastic-otel-dotnet/releases/download/${EDOT_VERSION}/elastic-dotnet-auto-install.sh | |
ENV OTEL_DOTNET_AUTO_HOME=/edot | |
WORKDIR /edot | |
RUN sh -c "$(curl -fsSL ${EDOT_INSTALL})" | |
FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION}-alpine AS app | |
WORKDIR /app | |
COPY *.csproj ./ | |
RUN dotnet restore | |
COPY . ./ | |
RUN dotnet publish -c Release -p:AssemblyName=app -o out | |
FROM mcr.microsoft.com/dotnet/runtime:${DOTNET_VERSION}-alpine | |
# Copy EDOT from the build stage | |
ENV OTEL_DOTNET_AUTO_HOME=/edot | |
COPY --from=edot /edot /edot | |
# Copy the application dll from the build stage | |
WORKDIR /app | |
COPY --from=app /app/out . | |
ENTRYPOINT ["/edot/instrument.sh", "dotnet", "app.dll"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment