-
Notifications
You must be signed in to change notification settings - Fork 340
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for more platforms, push to Docker Hub (#164)
- Build binaries for more versions of arm, 386, ppc64le, mips64le and s390x - Build docker images for ARM and ppc64 (other platforms are not supported by distroless docker image) and push them to Docker Hub
- Loading branch information
Showing
4 changed files
with
45 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,28 @@ | ||
FROM golang:1.16 as builder | ||
FROM golang:1.16-alpine as builder | ||
ARG VERSION | ||
ARG GIT_COMMIT | ||
ARG TARGETARCH | ||
|
||
WORKDIR /go/src/github.com/nginxinc/nginx-prometheus-exporter | ||
COPY *.go ./ | ||
COPY vendor ./vendor | ||
COPY go.mod go.sum ./ | ||
COPY collector ./collector | ||
COPY client ./client | ||
RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux go build -mod=vendor -a -ldflags "-X main.version=${VERSION} -X main.commit=${GIT_COMMIT}" -o exporter . | ||
RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=$TARGETARCH go build -mod=vendor -a -ldflags "-s -w -X main.version=${VERSION} -X main.commit=${GIT_COMMIT}" -o nginx-prometheus-exporter . | ||
|
||
FROM gcr.io/distroless/static-debian10:nonroot | ||
COPY --from=builder /go/src/github.com/nginxinc/nginx-prometheus-exporter/exporter /usr/bin/ | ||
|
||
FROM gcr.io/distroless/static-debian10:nonroot as base | ||
USER 1001:1001 | ||
ENTRYPOINT [ "/usr/bin/nginx-prometheus-exporter" ] | ||
|
||
|
||
FROM base as container | ||
COPY --from=builder /go/src/github.com/nginxinc/nginx-prometheus-exporter/nginx-prometheus-exporter /usr/bin/ | ||
|
||
|
||
FROM base as local | ||
ARG TARGETARCH | ||
ARG TARGETVARIANT | ||
|
||
ENTRYPOINT [ "/usr/bin/exporter" ] | ||
COPY dist/nginx-prometheus-exporter_linux_$TARGETARCH${TARGETVARIANT:+_7}/nginx-prometheus-exporter /usr/bin |