-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
42 lines (31 loc) · 1.25 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
FROM golang:1.11.2-alpine as builder
ENV GO111MODULE=on
ARG SOURCE_COMMIT
ARG VERSION=latest
ARG SOURCE_BRANCH=master
ARG USER=xxxcoltxxx
WORKDIR /go/src/github.com/xxxcoltxxx/smsc-balance-exporter
COPY . .
# Install external dependcies
RUN apk add --no-cache ca-certificates curl git
# Compile binary
RUN CGO_ENABLED=0 GOOS=`go env GOHOSTOS` GOARCH=`go env GOHOSTARCH` go build -o smsc_balance_exporter -ldflags " \
-X github.com/prometheus/common/version.Revision=${SOURCE_COMMIT} \
-X github.com/prometheus/common/version.Version=${VERSION} \
-X github.com/prometheus/common/version.Branch=${SOURCE_BRANCH} \
-X github.com/prometheus/common/version.BuildDate=$(date +'%Y-%m-%d_%H:%M:%S') \
-X github.com/prometheus/common/version.BuildUser=${USER} \
"
# Copy compiled binary to clear Alpine Linux image
FROM alpine:latest
ARG VERSION=latest
LABEL maintainer="Aleksandr Paramonov<[email protected]>"
LABEL version="${VERSION}"
LABEL description="Balance exporter for https://smsc.ru service"
WORKDIR /
RUN apk add --no-cache ca-certificates
COPY --from=builder /go/src/github.com/xxxcoltxxx/smsc-balance-exporter .
COPY static ./static
RUN chmod +x smsc_balance_exporter
EXPOSE 9601
CMD ["./smsc_balance_exporter"]