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
|
FROM golang:1.11 AS builder
|
||||||
ADD . /go/src/github.com/kumina/postfix_exporter
|
WORKDIR /src
|
||||||
WORKDIR /go/src/github.com/kumina/postfix_exporter
|
|
||||||
|
# avoid downloading the dependencies on succesive builds
|
||||||
RUN apt-get update -qq && apt-get install -qqy \
|
RUN apt-get update -qq && apt-get install -qqy \
|
||||||
build-essential \
|
build-essential \
|
||||||
libsystemd-dev
|
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
|
FROM debian:latest
|
||||||
EXPOSE 9154
|
EXPOSE 9154
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
COPY --from=0 /go/src/github.com/kumina/postfix_exporter/postfix_exporter .
|
COPY --from=builder /bin/postfix_exporter /bin/
|
||||||
ENTRYPOINT ["/postfix_exporter"]
|
ENTRYPOINT ["/bin/postfix_exporter"]
|
||||||
|
Loading…
Reference in New Issue
Block a user