From 5121d03b6f90905d10043de6799f96da7339812c Mon Sep 17 00:00:00 2001 From: Hunter Nield Date: Tue, 13 Jun 2017 12:58:18 +0800 Subject: [PATCH] Update Dockerfile with multistage build - Gets the image size down to around 60MB - Bumps up the base image to 16.04 --- Dockerfile | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index bbc083a..c40984f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:14.04 +FROM ubuntu:16.04 as builder MAINTAINER Vaibhav Bhembre ENV GOROOT /goroot @@ -9,7 +9,7 @@ ENV APPLOC $GOPATH/src/github.com/digitalocean/ceph_exporter RUN apt-get update && \ apt-get install -y apt-transport-https build-essential git curl -RUN echo "deb https://download.ceph.com/debian-jewel trusty main" >> /etc/apt/sources.list +RUN echo "deb https://download.ceph.com/debian-jewel xenial main" >> /etc/apt/sources.list RUN apt-get update && \ apt-get install -y --force-yes librados-dev librbd-dev @@ -23,5 +23,20 @@ WORKDIR $APPLOC RUN go get -d && \ go build -o /bin/ceph_exporter + +FROM ubuntu:16.04 +MAINTAINER Vaibhav Bhembre + +RUN apt-get update && \ + apt-get install -y apt-transport-https curl && \ + echo "deb https://download.ceph.com/debian-jewel xenial main" >> /etc/apt/sources.list && \ + apt-get update && \ + apt-get install -y --force-yes librados2 librbd1 && \ + rm -rf /var/lib/apt/lists/* + + +COPY --from=builder /bin/ceph_exporter /bin/ceph_exporter +RUN chmod +x /bin/ceph_exporter + EXPOSE 9128 ENTRYPOINT ["/bin/ceph_exporter"]