-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathitest.Dockerfile
More file actions
62 lines (47 loc) · 2.51 KB
/
itest.Dockerfile
File metadata and controls
62 lines (47 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
ARG SDK_VERSION=8.0
ARG PYROSCOPE_SDK_IMAGE
ARG SDK_IMAGE_SUFFIX
# The build images takes an SDK image of the buildplatform, so the platform the build is running on.
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:$SDK_VERSION$SDK_IMAGE_SUFFIX AS build
ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG SDK_VERSION
ARG SDK_IMAGE_SUFFIX
WORKDIR /dotnet
COPY IntegrationTest ./app
COPY Pyroscope/Directory.Build.props ./Pyroscope/Directory.Build.props
COPY Pyroscope/package-logo.png ./Pyroscope/package-logo.png
COPY Pyroscope/Pyroscope ./Pyroscope/Pyroscope
# Set the target framework to SDK_VERSION
RUN sed -i -E 's|<TargetFrameworks>.*</TargetFrameworks>|<TargetFramework>net'$SDK_VERSION'</TargetFramework>|' ./app/Rideshare.csproj
WORKDIR /dotnet/app
# We hardcode linux-x64 here, as the profiler doesn't support any other platform.
# Publish to a separate directory: .NET 10+ cleans the output dir before compiling,
# so -o . (source dir) would delete source files and cause CS5001.
RUN dotnet publish -o /dotnet/publish --framework net$SDK_VERSION --runtime linux-x64 --no-self-contained
# This uses a locally built image of the SDK
FROM --platform=linux/amd64 $PYROSCOPE_SDK_IMAGE AS sdk
ARG PYROSCOPE_SDK_IMAGE
# Runtime only image of the targetplatfrom, so the platform the image will be running on.
FROM --platform=linux/amd64 mcr.microsoft.com/dotnet/aspnet:$SDK_VERSION$SDK_IMAGE_SUFFIX
WORKDIR /dotnet
# place the binaries in a subfolder - to rigger a problme when SONAME was Datadog.Profiler.Native
# and dynamic linker could not find the profiler lib.
COPY --from=sdk /Pyroscope.Profiler.Native.so ./subfolder/Pyroscope.Profiler.Native.so
COPY --from=sdk /Pyroscope.Linux.ApiWrapper.x64.so ./subfolder/Pyroscope.Linux.ApiWrapper.x64.so
COPY --from=build /dotnet/publish ./
# Fix for alpine not being able to dlopen an already loaded library
ENV LD_LIBRARY_PATH=/dotnet/subfolder/
ENV CORECLR_ENABLE_PROFILING=1
ENV CORECLR_PROFILER={BD1A650D-AC5D-4896-B64F-D6FA25D6B26A}
ENV CORECLR_PROFILER_PATH=/dotnet/subfolder/Pyroscope.Profiler.Native.so
ENV LD_PRELOAD=/dotnet/subfolder/Pyroscope.Linux.ApiWrapper.x64.so
ENV PYROSCOPE_SERVER_ADDRESS=http://pyroscope:4040
ENV PYROSCOPE_LOG_LEVEL=debug
ENV PYROSCOPE_PROFILING_ENABLED=1
ENV PYROSCOPE_PROFILING_ALLOCATION_ENABLED=true
ENV PYROSCOPE_PROFILING_CONTENTION_ENABLED=true
ENV PYROSCOPE_PROFILING_EXCEPTION_ENABLED=true
ENV PYROSCOPE_PROFILING_HEAP_ENABLED=true
ENV RIDESHARE_LISTEN_PORT=5000
CMD sh -c "ASPNETCORE_URLS=http://*:${RIDESHARE_LISTEN_PORT} exec dotnet /dotnet/rideshare.dll"