Merge remote-tracking branch 'digineo/gomod' into digineo-updates

# Conflicts:
#	Dockerfile
#	go.mod
#	go.sum
This commit is contained in:
Per Abich 2020-02-19 18:16:20 +01:00
commit fd473ea329
2 changed files with 24 additions and 18 deletions

View File

@ -1,26 +1,24 @@
# Builder stage to
FROM golang:1.13 as builder
FROM golang:1.13 AS builder
WORKDIR /src
# Add the project in the image
ADD . /build
WORKDIR /build
# Install needed dependencies for the build
RUN apt-get update -q && apt-get install -qy \
# avoid downloading the dependencies on succesive builds
RUN apt-get update -qq && apt-get install -qqy \
build-essential \
libsystemd-dev
# Get dependencies and build the static binary
COPY go.mod go.sum ./
RUN go mod download
RUN go mod verify
COPY . .
# Force the go compiler to use modules
ENV GO111MODULE=on
RUN go test
RUN go build -a -tags static_all
RUN go build -o /bin/postfix_exporter
# Real image
FROM debian:latest
EXPOSE 9154
WORKDIR /
# Copy the binary from the build image to the real one
COPY --from=builder /build/postfix_exporter .
ENTRYPOINT ["/postfix_exporter"]
COPY --from=builder /bin/postfix_exporter /bin/
ENTRYPOINT ["/bin/postfix_exporter"]

10
go.mod
View File

@ -10,6 +10,14 @@ require (
github.com/prometheus/client_golang v1.4.1
github.com/prometheus/client_model v0.2.0
github.com/stretchr/testify v1.4.0
gopkg.in/fsnotify.v1 v1.4.7 // indirect
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f // indirect
github.com/fsnotify/fsnotify v1.4.7 // indirect
github.com/hpcloud/tail v1.0.0
github.com/prometheus/client_golang v0.9.2
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 // indirect
github.com/prometheus/common v0.2.0 // indirect
github.com/prometheus/procfs v0.0.0-20190219184716-e4d4a2206da0 // indirect
github.com/stretchr/testify v1.3.0 // indirect
golang.org/x/sys v0.0.0-20190220154126-629670e5acc5 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
)