From 9243e9fc9f35a06e75e5188ff5c9393fcc01bfb1 Mon Sep 17 00:00:00 2001 From: Conrad Hoffmann Date: Sat, 26 Oct 2019 15:20:09 +0200 Subject: [PATCH] Misc fixes for the Dockerfile - Copy local repo when building instead of using go get - Fix accidentally copying dir instead of executable to final container - Use combination of ENTRYPOINT and CMD as preset Fixes #37, #38. --- Dockerfile | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4b589a9..536794c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,24 +1,17 @@ # Build /go/bin/ipmi_exporter FROM quay.io/prometheus/golang-builder:1.13-base AS builder - -RUN go get -d github.com/soundcloud/ipmi_exporter \ - && cd /go/src/github.com/soundcloud/ipmi_exporter \ - && make - +ADD . /go/src/github.com/soundcloud/ipmi_exporter/ +RUN cd /go/src/github.com/soundcloud/ipmi_exporter && make # Container image FROM ubuntu:18.04 - -LABEL maintainer="Aggelos Kolaitis " - WORKDIR / - RUN apt-get update \ && apt-get install freeipmi-tools -y --no-install-recommends \ && rm -rf /var/lib/apt/lists/* -COPY --from=builder /go/src/github.com/soundcloud/ipmi_exporter /bin/ipmi_exporter +COPY --from=builder /go/src/github.com/soundcloud/ipmi_exporter/ipmi_exporter /bin/ipmi_exporter EXPOSE 9290 - -CMD ["/bin/ipmi_exporter", "--config.file", "/config.yml"] +ENTRYPOINT ["/bin/ipmi_exporter"] +CMD ["--config.file", "/config.yml"]