Skip to content

Commit 8889bfd

Browse files
committed
build(Dockerfile): Build with libpfm4 from Ubuntu repository
Build the sensor with the upstream libpfm4 instead of the PowerAPI fork.
1 parent 13043fc commit 8889bfd

File tree

1 file changed

+2
-19
lines changed

1 file changed

+2
-19
lines changed

Dockerfile

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,11 @@
1-
# libpfm dependency builder image
2-
FROM ubuntu:24.04 as libpfm-builder
3-
ENV DEBIAN_FRONTEND=noninteractive
4-
RUN apt update && \
5-
apt install -y build-essential git devscripts debhelper libncurses-dev && \
6-
git clone -b smartwatts https://github.com/gfieni/libpfm4.git /root/libpfm4 && \
7-
cd /root/libpfm4 && \
8-
sed -i 's/CONFIG_PFMLIB_NOPYTHON=n/CONFIG_PFMLIB_NOPYTHON=y/' debian/rules && \
9-
sed -i '/^Package: python-libpfm4$/,/^$/d' debian/control && \
10-
fakeroot debian/rules binary
11-
121
# sensor builder image (build tools + development dependencies):
132
FROM ubuntu:24.04 as sensor-builder
143
ENV DEBIAN_FRONTEND=noninteractive
154
ARG BUILD_TYPE=Debug
165
ARG MONGODB_SUPPORT=ON
176
RUN apt update && \
18-
apt install -y build-essential git clang-tidy cmake pkg-config libczmq-dev libjson-c-dev libsystemd-dev uuid-dev && \
7+
apt install -y build-essential git clang-tidy cmake pkg-config libczmq-dev libpfm4-dev libjson-c-dev libsystemd-dev uuid-dev && \
198
echo "${MONGODB_SUPPORT}" |grep -iq "on" && apt install -y libmongoc-dev || true
20-
COPY --from=libpfm-builder /root/libpfm4*.deb /tmp/
21-
RUN dpkg -i /tmp/libpfm4_*.deb /tmp/libpfm4-dev_*.deb && \
22-
rm /tmp/*.deb
239
COPY . /usr/src/hwpc-sensor
2410
RUN cd /usr/src/hwpc-sensor && \
2511
GIT_TAG=$(git describe --tags --dirty 2>/dev/null || echo "unknown") \
@@ -35,13 +21,10 @@ ARG MONGODB_SUPPORT=ON
3521
ARG FILE_CAPABILITY=CAP_SYS_ADMIN
3622
RUN useradd -d /opt/powerapi -m powerapi && \
3723
apt update && \
38-
apt install -y libczmq4 libjson-c5 libcap2-bin && \
24+
apt install -y libczmq4 libpfm4 libjson-c5 libcap2-bin && \
3925
echo "${MONGODB_SUPPORT}" |grep -iq "on" && apt install -y libmongoc-1.0-0 || true && \
4026
echo "${BUILD_TYPE}" |grep -iq "debug" && apt install -y libasan8 libubsan1 || true && \
4127
rm -rf /var/lib/apt/lists/*
42-
COPY --from=libpfm-builder /root/libpfm4*.deb /tmp/
43-
RUN dpkg -i /tmp/libpfm4_*.deb && \
44-
rm /tmp/*.deb
4528
COPY --from=sensor-builder /usr/src/hwpc-sensor/build/hwpc-sensor /usr/bin/hwpc-sensor
4629
RUN setcap "${FILE_CAPABILITY}+ep" /usr/bin/hwpc-sensor && \
4730
setcap -v "${FILE_CAPABILITY}+ep" /usr/bin/hwpc-sensor

0 commit comments

Comments
 (0)