-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathDockerfile
56 lines (41 loc) · 1.02 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
####################
## STEP 1: Build ##
####################
# Image Base
FROM golang:1.14 AS builder
# Arguments
ARG VERSION="0.0"
# Labels
LABEL version=$VERSION
LABEL description="Keedio Cloudera Exporter Builder"
LABEL vendor="Keedio"
# Code copy
RUN mkdir /go/cloudera_exporter_code
WORKDIR /go/cloudera_exporter_code
COPY . .
# Environment variable to Static-link compilation
ENV CGO_ENABLED 0
# Work Go Path
ENV GOPATH /go
# GO OS system for compatibility compilation
ENV GOOS linux
# GO OS system architecture
ENV GOARCH amd64
# Run command
RUN make build
####################
## STEP 2: Run ##
####################
FROM scratch
# Arguments
ARG VERSION="0.0"
# Labels
LABEL version=$VERSION
LABEL description="Keedio Cloudera Exporter Builder"
LABEL vendor="Keedio"
# Binary
COPY --from=builder /go/cloudera_exporter_code/cloudera_exporter /cloudera_exporter
# Config File
COPY --from=builder /go/cloudera_exporter_code/config.ini /config.ini
EXPOSE 9200
ENTRYPOINT ["/cloudera_exporter", "--config-file", "/config.ini"]