From 8ec0010f362801445e31b3b31de954acdd3a6bec Mon Sep 17 00:00:00 2001 From: Stefan Steinert Date: Fri, 11 Mar 2022 13:18:07 +0100 Subject: [PATCH] Added multi-stage build, bumped alpine and libxml versions (#31) --- Dockerfile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6283842..523eba8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ -FROM golang:1.17.3-alpine3.14 +FROM golang:1.17.3-alpine3.15 AS build ENV LIBVIRT_EXPORTER_PATH=/libvirt-exporter -ENV LIBXML2_VER=2.9.8 +ENV LIBXML2_VER=2.9.12 RUN apk add ca-certificates g++ git libnl-dev linux-headers make libvirt-dev libvirt && \ wget ftp://xmlsoft.org/libxml2/libxml2-${LIBXML2_VER}.tar.gz -P /tmp && \ @@ -16,4 +16,9 @@ COPY . . RUN go build -mod vendor -ENTRYPOINT [ "./libvirt-exporter" ] +FROM alpine:3.15 +RUN apk add ca-certificates libvirt +COPY --from=build $LIBVIRT_EXPORTER_PATH/libvirt-exporter / +EXPOSE 9177 + +ENTRYPOINT [ "/libvirt-exporter" ]