File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change 1- ARG ARCH="amd64"
2- ARG OS="linux"
3- FROM quay.io/prometheus/busybox-${OS}-${ARCH}:latest
1+
2+ FROM golang:1.19-alpine as build
3+ WORKDIR ${GOPATH}/src/github.com/quintoandar
4+ RUN apk update && apk add make git curl && git clone --branch main https://github.com/quintoandar/postgres_exporter.git
5+ WORKDIR ${GOPATH}/src/github.com/quintoandar/postgres_exporter
6+ ENV GOARCH=amd64
7+ RUN make release
8+ RUN chmod +x postgres_exporter && mv postgres_exporter /tmp/postgres_exporter
9+
10+ FROM quay.io/prometheus/busybox:latest as final
411LABEL maintainer=
"The Prometheus Authors <[email protected] >" 512
6- ARG ARCH="amd64"
7- ARG OS="linux"
8- COPY .build/${OS}-${ARCH}/postgres_exporter /bin/postgres_exporter
13+ COPY --from=build ["/tmp/postgres_exporter" , "/bin/postgres_exporter" ]
914
1015EXPOSE 9187
1116USER nobody
Original file line number Diff line number Diff line change @@ -14,4 +14,4 @@ GO_BUILD_LDFLAGS = -X github.com/prometheus/common/version.Version=$(shell cat V
1414export PMM_RELEASE_PATH? =.
1515
1616release :
17- go build -ldflags=" $( GO_BUILD_LDFLAGS) " -o $(PMM_RELEASE_PATH ) /postgres_exporter ./cmd/postgres_exporter
17+ GOOS=linux go build -ldflags=" $( GO_BUILD_LDFLAGS) " -o $(PMM_RELEASE_PATH ) /postgres_exporter ./cmd/postgres_exporter
You can’t perform that action at this time.
0 commit comments