Skip to content

Commit

Permalink
Added multi-stage build, bumped alpine and libxml versions (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
ststefa authored Mar 11, 2022
1 parent 14c6d80 commit 8ec0010
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 && \
Expand All @@ -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" ]

0 comments on commit 8ec0010

Please sign in to comment.