apcupsd_exporter: add Dockerfile

This commit is contained in:
Jan Willhaus 2019-07-16 21:13:52 +02:00 committed by Jan Willhaus
parent 43387c6d02
commit 79016c5bc0
No known key found for this signature in database
GPG Key ID: DCA16A84678D0F6D
1 changed files with 22 additions and 0 deletions

22
Dockerfile Normal file
View File

@ -0,0 +1,22 @@
FROM golang:1.12 as build
ARG GO111MODULE=on
ARG CGO_ENABLED=0
ARG GOOS=linux
ARG GOARCH=amd64
WORKDIR /go/src/app
COPY . ./
RUN go build \
-a \
-tags netgo \
-ldflags '-w -extldflags "-static"' \
-o apcupsd_exporter \
cmd/apcupsd_exporter/main.go
FROM scratch
COPY --from=build /go/src/app/apcupsd_exporter /
EXPOSE 9162
ENTRYPOINT [ "/apcupsd_exporter" ]