-
Notifications
You must be signed in to change notification settings - Fork 89
Expand file tree
/
Copy pathDockerfile.otlp
More file actions
89 lines (76 loc) · 2.56 KB
/
Copy pathDockerfile.otlp
File metadata and controls
89 lines (76 loc) · 2.56 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Dockerfile.otlp
# Builds dynolog with both Prometheus and OTLP metrics export.
# Uses local source tree as build context (COPY . approach).
#
# Build on Linux x86_64 dev host:
# docker build -t dynolog:v0.3.0-otlp -f Dockerfile.otlp .
#
# Build time: ~5-10 min (protobuf stubs from opentelemetry-proto)
# --- Build stage ---
FROM ubuntu:22.04 AS builder
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cmake \
ninja-build \
git \
ca-certificates \
curl \
libboost-all-dev \
libnl-3-dev \
libnl-route-3-dev \
libelf-dev \
libssl-dev \
libcurl4-openssl-dev \
libprotobuf-dev \
protobuf-compiler \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
# Rust (needed for the dyno CLI)
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
# Build prometheus-cpp from source (for USE_PROMETHEUS=ON)
RUN git clone --depth 1 --branch v1.3.0 --recurse-submodules \
https://github.com/jupp0r/prometheus-cpp.git /src/prometheus-cpp \
&& cd /src/prometheus-cpp \
&& cmake -S . -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_TESTING=OFF \
-DENABLE_PUSH=OFF \
-DBUILD_SHARED_LIBS=ON \
&& cmake --build build -j$(nproc) \
&& cmake --install build
# Copy local dynolog source (includes opentelemetry-proto submodule)
COPY . /src/dynolog
WORKDIR /src/dynolog
# Build with both Prometheus AND OTLP.
# OTLP uses protobuf stubs generated from opentelemetry-proto + libcurl.
RUN cmake -S . -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTING=OFF \
-DCPR_ENABLE_SSL=ON \
-DUSE_PROMETHEUS=ON \
-DUSE_OTLP=ON \
&& cmake --build build --target dynolog -j$(nproc)
# --- Runtime stage ---
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y --no-install-recommends \
libboost-program-options1.74.0 \
libboost-system1.74.0 \
libnl-3-200 \
libnl-route-3-200 \
libelf1 \
libssl3 \
libcurl4 \
ca-certificates \
wget \
&& rm -rf /var/lib/apt/lists/*
# Copy dynolog binary and prometheus-cpp shared libs
COPY --from=builder /src/dynolog/build/dynolog/src/dynolog /usr/local/bin/dynolog
COPY --from=builder /usr/local/lib/libprometheus-cpp-*.so* /usr/local/lib/
RUN ldconfig
EXPOSE 1778
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD wget -qO- http://localhost:1778/metrics >/dev/null 2>&1 || exit 1
ENTRYPOINT ["dynolog"]
CMD ["--enable_gpu_monitor=false", "--use_JSON=true"]