forked from Tinkoff/libvirt-exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerbuildimage
22 lines (20 loc) · 981 Bytes
/
Dockerbuildimage
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Stage 1: Build libvirt exporter
FROM golang:alpine
ENV libxml2_version 2.9.8
ENV libvirt_version 3.8.0
# Install dependencies
RUN set -ex
RUN apk add --update git gcc g++ make libc-dev portablexdr-dev linux-headers libnl-dev perl libtirpc-dev pkgconfig wget python python-dev libxslt upx
RUN wget ftp://xmlsoft.org/libxml2/libxml2-${libxml2_version}.tar.gz -P /tmp && \
tar -xf /tmp/libxml2-${libxml2_version}.tar.gz -C /tmp
WORKDIR /tmp/libxml2-${libxml2_version}
RUN ./configure --disable-shared --enable-static && \
make -j$(nproc) && \
make install
RUN wget https://libvirt.org/sources/libvirt-${libvirt_version}.tar.xz -P /tmp && \
tar -xf /tmp/libvirt-${libvirt_version}.tar.xz -C /tmp
WORKDIR /tmp/libvirt-${libvirt_version}
RUN ./configure --disable-shared --enable-static --localstatedir=/var --without-storage-mpath && \
make -j$(nproc) && \
make install && \
sed -i 's/^Libs:.*/& -lnl -ltirpc -lxml2/' /usr/local/lib/pkgconfig/libvirt.pc