Skip to content

Commit 0820dd6

Browse files
author
Petr Matousek
committed
fix: Build opentelemetry-cpp from source
- Add build of opentelemetry-cpp v1.16.1 from source - Install required dependencies: protobuf, grpc, c-ares, re2 - Build with OTLP (gRPC and HTTP) and zpages support - Copy built libraries to runtime stage - Resolves missing opentelemetry-cpp package issue
1 parent 399335d commit 0820dd6

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,30 @@ RUN dnf -y --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install \
2828
cmake ninja-build \
2929
gcc gcc-c++ \
3030
\
31+
protobuf-devel \
32+
grpc-devel grpc-plugins \
33+
c-ares-devel \
34+
re2-devel \
35+
\
3136
cyrus-sasl-devel \
3237
openssl-devel \
3338
python-devel
3439

40+
# Build opentelemetry-cpp from source
41+
ENV OTEL_VERSION=v1.16.1
42+
RUN git clone --branch=${OTEL_VERSION} --depth=1 --recurse-submodules --shallow-submodules https://github.com/open-telemetry/opentelemetry-cpp.git && \
43+
cmake -S opentelemetry-cpp -B cmake-build-opentelemetry -GNinja \
44+
-DCMAKE_INSTALL_PREFIX=/usr/local \
45+
-DCMAKE_BUILD_TYPE=Release \
46+
-DBUILD_TESTING=OFF \
47+
-DWITH_EXAMPLES=OFF \
48+
-DWITH_OTLP_GRPC=ON \
49+
-DWITH_OTLP_HTTP=ON \
50+
-DWITH_ZPAGES=ON && \
51+
cmake --build cmake-build-opentelemetry && \
52+
cmake --install cmake-build-opentelemetry && \
53+
rm -rf opentelemetry-cpp cmake-build-opentelemetry
54+
3555
COPY . /src
3656
WORKDIR /src
3757

@@ -74,9 +94,14 @@ RUN dnf install -y 'dnf-command(config-manager)'
7494
RUN /usr/bin/crb enable
7595

7696
RUN dnf -y --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install \
97+
protobuf \
98+
grpc \
99+
c-ares \
100+
re2 \
77101
cyrus-sasl cyrus-sasl-gssapi cyrus-sasl-lib cyrus-sasl-plain \
78102
openssl
79103

104+
COPY --from=build /usr/local/ /usr/local/
80105
COPY --from=build /src/cmake-install/ /usr/local
81106

82107
RUN mkdir /var/lib/cli-cpp && \

0 commit comments

Comments
 (0)