Skip to content

Commit 4aa5c37

Browse files
committed
chore: build inside dockerfile
1 parent 5bfc246 commit 4aa5c37

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

Dockerfile

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
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+
RUN make release
7+
RUN chmod +x postgres_exporter && mv postgres_exporter /tmp/postgres_exporter
8+
9+
FROM quay.io/prometheus/busybox:latest as final
410
LABEL maintainer="The Prometheus Authors <prometheus-developers@googlegroups.com>"
511

6-
ARG ARCH="amd64"
7-
ARG OS="linux"
8-
COPY .build/${OS}-${ARCH}/postgres_exporter /bin/postgres_exporter
12+
COPY --from=build ["/tmp/postgres_exporter", "/bin/postgres_exporter" ]
913

1014
EXPOSE 9187
1115
USER nobody

0 commit comments

Comments
 (0)