2020-02-19 17:16:20 +00:00
|
|
|
FROM golang:1.13 AS builder
|
2019-01-28 00:26:44 +00:00
|
|
|
WORKDIR /src
|
2019-10-31 17:22:22 +00:00
|
|
|
|
2019-01-28 00:26:44 +00:00
|
|
|
# avoid downloading the dependencies on succesive builds
|
2018-11-04 01:57:56 +00:00
|
|
|
RUN apt-get update -qq && apt-get install -qqy \
|
|
|
|
build-essential \
|
|
|
|
libsystemd-dev
|
|
|
|
|
2019-01-28 00:26:44 +00:00
|
|
|
COPY go.mod go.sum ./
|
|
|
|
RUN go mod download
|
|
|
|
RUN go mod verify
|
|
|
|
|
|
|
|
COPY . .
|
|
|
|
|
|
|
|
# Force the go compiler to use modules
|
|
|
|
ENV GO111MODULE=on
|
2020-02-12 12:41:29 +00:00
|
|
|
RUN go test
|
2019-01-28 00:26:44 +00:00
|
|
|
RUN go build -o /bin/postfix_exporter
|
2019-10-31 17:22:22 +00:00
|
|
|
|
2018-11-04 01:57:56 +00:00
|
|
|
FROM debian:latest
|
|
|
|
EXPOSE 9154
|
|
|
|
WORKDIR /
|
2019-01-28 00:26:44 +00:00
|
|
|
COPY --from=builder /bin/postfix_exporter /bin/
|
|
|
|
ENTRYPOINT ["/bin/postfix_exporter"]
|