Update Dockerfile to use Go 1.11 with modules
This commit is contained in:
parent
acf7a97917
commit
99db0017f8
23
Dockerfile
23
Dockerfile
@ -1,14 +1,23 @@
|
||||
FROM golang:1.8
|
||||
ADD . /go/src/github.com/kumina/postfix_exporter
|
||||
WORKDIR /go/src/github.com/kumina/postfix_exporter
|
||||
FROM golang:1.11 AS builder
|
||||
WORKDIR /src
|
||||
|
||||
# avoid downloading the dependencies on succesive builds
|
||||
RUN apt-get update -qq && apt-get install -qqy \
|
||||
build-essential \
|
||||
libsystemd-dev
|
||||
RUN go get -v ./...
|
||||
RUN go build
|
||||
|
||||
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 build -o /bin/postfix_exporter
|
||||
|
||||
FROM debian:latest
|
||||
EXPOSE 9154
|
||||
WORKDIR /
|
||||
COPY --from=0 /go/src/github.com/kumina/postfix_exporter/postfix_exporter .
|
||||
ENTRYPOINT ["/postfix_exporter"]
|
||||
COPY --from=builder /bin/postfix_exporter /bin/
|
||||
ENTRYPOINT ["/bin/postfix_exporter"]
|
||||
|
Loading…
Reference in New Issue
Block a user