| 1 |
# Copyright The OpenTelemetry Authors |
| 2 |
# SPDX-License-Identifier: Apache-2.0 |
| 3 |
|
| 4 |
ARG BASE_IMAGE=ubuntu:latest |
| 5 |
ARG GRPC_IMAGE=grpc-${BASE_IMAGE} |
| 6 |
|
| 7 |
FROM ${GRPC_IMAGE} as grpc |
| 8 |
|
| 9 |
FROM base-${BASE_IMAGE}-dev AS otel-cpp |
| 10 |
|
| 11 |
ARG CORES=${nproc} |
| 12 |
ARG OTEL_GIT_TAG=v1.3.0 |
| 13 |
|
| 14 |
COPY --from=grpc / /usr/local |
| 15 |
|
| 16 |
#install opentelemetry-cpp |
| 17 |
RUN git clone --recurse-submodules -j ${CORES} --depth=1 \ |
| 18 |
-b ${OTEL_GIT_TAG} https://github.com/open-telemetry/opentelemetry-cpp.git \ |
| 19 |
&& cd opentelemetry-cpp \ |
| 20 |
&& mkdir -p build && cd build \ |
| 21 |
&& cmake \ |
| 22 |
-DCMAKE_BUILD_TYPE=Release \ |
| 23 |
-DCMAKE_POSITION_INDEPENDENT_CODE=TRUE \ |
| 24 |
-DWITH_ZIPKIN=ON \ |
| 25 |
-DCMAKE_INSTALL_PREFIX=/opt/third_party/install \ |
| 26 |
-DBUILD_TESTING=OFF \ |
| 27 |
-DWITH_OTLP_GRPC=ON \ |
| 28 |
-DWITH_OTLP_HTTP=ON \ |
| 29 |
-DBUILD_SHARED_LIBS=ON \ |
| 30 |
.. \ |
| 31 |
&& cmake --build . -j ${CORES} --target install |
| 32 |
|
| 33 |
FROM scratch as final |
| 34 |
|
| 35 |
COPY --from=otel-cpp /opt/third_party/install / |