postfix_exporter/Dockerfile

27 lines
521 B
Docker
Raw Normal View History

2019-10-31 17:22:22 +00:00
# Builder stage to
FROM golang:1.13 as builder
2019-10-31 17:22:22 +00:00
# Add the project in the image
2020-02-18 12:33:30 +00:00
ADD . /build
WORKDIR /build
2019-10-31 17:22:22 +00:00
# Install needed dependencies for the build
RUN apt-get update -q && apt-get install -qy \
2018-11-04 01:57:56 +00:00
build-essential \
libsystemd-dev
2019-10-31 17:22:22 +00:00
# Get dependencies and build the static binary
RUN go test
2019-10-31 17:22:22 +00:00
RUN go build -a -tags static_all
# Real image
2018-11-04 01:57:56 +00:00
FROM debian:latest
2019-10-31 17:22:22 +00:00
2018-11-04 01:57:56 +00:00
EXPOSE 9154
WORKDIR /
2019-10-31 17:22:22 +00:00
# Copy the binary from the build image to the real one
2020-02-18 12:33:30 +00:00
COPY --from=builder /build/postfix_exporter .
2019-10-31 17:22:22 +00:00
2018-11-04 01:57:56 +00:00
ENTRYPOINT ["/postfix_exporter"]