-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (35 loc) · 1.76 KB
/
Copy pathDockerfile
File metadata and controls
36 lines (35 loc) · 1.76 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
# sensor builder image (build tools + development dependencies):
FROM ubuntu:26.04@sha256:f3d28607ddd78734bb7f71f117f3c6706c666b8b76cbff7c9ff6e5718d46ff64 AS sensor-builder
ENV DEBIAN_FRONTEND=noninteractive
ARG BUILD_TYPE=Debug
ARG CAPABILITIES_HARDENING=ON
ARG MONGODB_SUPPORT=ON
RUN apt update && \
apt install -y build-essential git clang-tidy cmake pkg-config libczmq-dev libpfm4-dev libjson-c-dev libsystemd-dev uuid-dev && \
echo "${MONGODB_SUPPORT}" |grep -iq "on" && apt install -y libmongoc-dev || true
COPY . /usr/src/hwpc-sensor
RUN cd /usr/src/hwpc-sensor && \
GIT_TAG=$(git describe --tags --dirty 2>/dev/null || echo "unknown") \
GIT_REV=$(git rev-parse HEAD 2>/dev/null || echo "unknown") \
cmake -B build \
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
-DCMAKE_C_CLANG_TIDY="clang-tidy" \
-DWITH_CAPABILITY_HARDENING="${CAPABILITIES_HARDENING}" \
-DWITH_MONGODB="${MONGODB_SUPPORT}" && \
cmake --build build --parallel $(getconf _NPROCESSORS_ONLN)
# sensor runner image (only runtime depedencies):
FROM ubuntu:26.04@sha256:f3d28607ddd78734bb7f71f117f3c6706c666b8b76cbff7c9ff6e5718d46ff64 AS sensor-runner
ENV DEBIAN_FRONTEND=noninteractive
ARG BUILD_TYPE=Debug
ARG MONGODB_SUPPORT=ON
RUN useradd -d /opt/powerapi -m powerapi && \
apt update && \
apt install -y libczmq4 libpfm4 libjson-c5 libcap2-bin && \
echo "${MONGODB_SUPPORT}" |grep -iq "on" && apt install -y libmongoc2-2 || true && \
echo "${BUILD_TYPE}" |grep -iq "debug" && apt install -y libasan8 libubsan1 || true && \
rm -rf /var/lib/apt/lists/*
COPY --from=sensor-builder /usr/src/hwpc-sensor/build/hwpc-sensor /usr/bin/hwpc-sensor
RUN setcap "cap_perfmon=p" /usr/bin/hwpc-sensor
COPY docker/entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["--help"]