-
Notifications
You must be signed in to change notification settings - Fork 8
/
Dockerfile
29 lines (20 loc) · 844 Bytes
/
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
ARG BUILDER_IMAGE=index.docker.io/library/golang@sha256:634cda4edda00e59167e944cdef546e2d62da71ef1809387093a377ae3404df0
ARG RUNTIME_IMAGE=gcr.io/distroless/static@sha256:c9320b754c2fa2cd2dea50993195f104a24f4c7ebe6e0297c6ddb40ce3679e7d
FROM $BUILDER_IMAGE as builder
WORKDIR /workspace
COPY .git .git
COPY go.mod go.mod
COPY go.sum go.sum
COPY pkg/ pkg/
COPY cmd/ cmd/
RUN set -x && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on \
go build -a -v \
-trimpath \
-tags osusergo,netgo,static_build \
-o monero-exporter \
./cmd/monero-exporter
FROM $RUNTIME_IMAGE
WORKDIR /
COPY --chown=nonroot:nonroot --from=builder /workspace/monero-exporter .
USER nonroot:nonroot
ENTRYPOINT ["/monero-exporter"]