-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathPyroscope.musl.Dockerfile
More file actions
69 lines (58 loc) · 2.54 KB
/
Pyroscope.musl.Dockerfile
File metadata and controls
69 lines (58 loc) · 2.54 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
63
64
65
66
67
68
FROM alpine:3.18 AS builder
RUN apk add \
clang \
cmake \
git \
bash \
make \
alpine-sdk \
util-linux-dev \
autoconf \
libtool \
automake \
xz-dev \
musl-dbg \
perl \
linux-headers
RUN apk add wget
RUN apk add go
# Build OpenSSL from source with static libs
ARG OPENSSL_VERSION=3.5.6
RUN wget -q "https://github.com/openssl/openssl/releases/download/openssl-${OPENSSL_VERSION}/openssl-${OPENSSL_VERSION}.tar.gz" && \
tar xf openssl-${OPENSSL_VERSION}.tar.gz && \
cd openssl-${OPENSSL_VERSION} && \
./config no-shared no-tests --prefix=/usr/local/openssl --openssldir=/etc/ssl && \
make -j$(nproc) && \
make install_sw && \
ln -s /usr/local/openssl/lib64 /usr/local/openssl/lib && \
cd .. && rm -rf openssl-${OPENSSL_VERSION} openssl-${OPENSSL_VERSION}.tar.gz
FROM builder as build
WORKDIR /profiler
ENV IsAlpine=true
ADD build build
ADD profiler profiler
ADD shared shared
ADD CMakeLists.txt CMakeLists.txt
# Allow build type to be passed as build arg, default to Release
ARG CMAKE_BUILD_TYPE=Release
RUN mkdir build-${CMAKE_BUILD_TYPE} && \
cd build-${CMAKE_BUILD_TYPE} && \
cmake .. \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \
-DCMAKE_CXX_FLAGS_DEBUG="-g -O0" \
-DCMAKE_C_FLAGS_DEBUG="-g -O0" \
-DOPENSSL_ROOT_DIR=/usr/local/openssl
RUN cd build-${CMAKE_BUILD_TYPE} && make -j16 Pyroscope.Profiler.Native Datadog.Linux.ApiWrapper.x64
FROM build AS test
RUN cd build-${CMAKE_BUILD_TYPE} && make -j$(nproc) profiler-native-tests wrapper-native-tests
# Run profiler unit tests
RUN cd build-${CMAKE_BUILD_TYPE}/profiler && ctest --output-on-failure -E "WrappedFunctionsTest"
# Run wrapper tests with LD_PRELOAD so wrapped functions resolve to the wrapper library
RUN WRAPPER_SO=$(find /profiler/profiler/_build/DDProf-Deploy/linux-musl -name "Datadog.Linux.ApiWrapper.x64.so" | head -1) && \
cd build-${CMAKE_BUILD_TYPE}/profiler && \
LD_PRELOAD="${WRAPPER_SO}" ctest --output-on-failure -R "WrappedFunctionsTest"
FROM busybox:1.37.0-musl@sha256:19b646668802469d968a05342a601e78da4322a414a7c09b1c9ee25165042138
COPY --from=build /profiler/profiler/_build/DDProf-Deploy/linux-musl/Pyroscope.Profiler.Native.so /Pyroscope.Profiler.Native.so
COPY --from=build /profiler/profiler/_build/DDProf-Deploy/linux-musl/Datadog.Linux.ApiWrapper.x64.so /Pyroscope.Linux.ApiWrapper.x64.so