File tree 1 file changed +17
-5
lines changed
1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change 1
- FROM golang:1.8
1
+ # Builder stage to
2
+ FROM golang:1.12 as builder
3
+
4
+ # Add the project in the image
2
5
ADD . /go/src/github.com/kumina/postfix_exporter
3
6
WORKDIR /go/src/github.com/kumina/postfix_exporter
4
- RUN apt-get update -qq && apt-get install -qqy \
7
+
8
+ # Install needed dependencies for the build
9
+ RUN apt-get update -q && apt-get install -qy \
5
10
build-essential \
6
11
libsystemd-dev
7
- RUN go get -v ./...
8
- RUN go build
9
12
13
+ # Get dependencies and build the static binary
14
+ RUN go get -d ./...
15
+ RUN go build -a -tags static_all
16
+
17
+ # Real image
10
18
FROM debian:latest
19
+
11
20
EXPOSE 9154
12
21
WORKDIR /
13
- COPY --from=0 /go/src/github.com/kumina/postfix_exporter/postfix_exporter .
22
+
23
+ # Copy the binary from the build image to the real one
24
+ COPY --from=builder /go/src/github.com/kumina/postfix_exporter/postfix_exporter .
25
+
14
26
ENTRYPOINT ["/postfix_exporter" ]
You can’t perform that action at this time.
0 commit comments