Merge remote-tracking branch 'digineo/gomod' into digineo-updates
# Conflicts: # Dockerfile # go.mod # go.sum
This commit is contained in:
commit
fd473ea329
32
Dockerfile
32
Dockerfile
@ -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
|
# avoid downloading the dependencies on succesive builds
|
||||||
ADD . /build
|
RUN apt-get update -qq && apt-get install -qqy \
|
||||||
WORKDIR /build
|
|
||||||
|
|
||||||
# Install needed dependencies for the build
|
|
||||||
RUN apt-get update -q && apt-get install -qy \
|
|
||||||
build-essential \
|
build-essential \
|
||||||
libsystemd-dev
|
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 test
|
||||||
RUN go build -a -tags static_all
|
RUN go build -o /bin/postfix_exporter
|
||||||
|
|
||||||
# Real image
|
|
||||||
FROM debian:latest
|
FROM debian:latest
|
||||||
|
|
||||||
EXPOSE 9154
|
EXPOSE 9154
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
|
COPY --from=builder /bin/postfix_exporter /bin/
|
||||||
# Copy the binary from the build image to the real one
|
ENTRYPOINT ["/bin/postfix_exporter"]
|
||||||
COPY --from=builder /build/postfix_exporter .
|
|
||||||
|
|
||||||
ENTRYPOINT ["/postfix_exporter"]
|
|
||||||
|
10
go.mod
10
go.mod
@ -10,6 +10,14 @@ require (
|
|||||||
github.com/prometheus/client_golang v1.4.1
|
github.com/prometheus/client_golang v1.4.1
|
||||||
github.com/prometheus/client_model v0.2.0
|
github.com/prometheus/client_model v0.2.0
|
||||||
github.com/stretchr/testify v1.4.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
|
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user