You've already forked nginx_exporter
mirror of
https://github.com/nginxinc/nginx-prometheus-exporter.git
synced 2025-07-31 21:04:21 +03:00
Use scratch to support building for more archs (#167)
Support mips64le and 386
This commit is contained in:
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@ -70,7 +70,7 @@ jobs:
|
|||||||
file: build/Dockerfile
|
file: build/Dockerfile
|
||||||
context: '.'
|
context: '.'
|
||||||
target: local
|
target: local
|
||||||
platforms: linux/arm,linux/arm64,linux/amd64,linux/ppc64le,linux/s390x
|
platforms: linux/arm,linux/arm64,linux/amd64,linux/ppc64le,linux/s390x,linux/mips64le,linux/386
|
||||||
cache-from: type=local,src=/tmp/.buildx-cache
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
cache-to: type=local,dest=/tmp/.buildx-cache
|
cache-to: type=local,dest=/tmp/.buildx-cache
|
||||||
tags: nginx/nginx-prometheus-exporter:${{ github.sha }}
|
tags: nginx/nginx-prometheus-exporter:${{ github.sha }}
|
||||||
@ -119,7 +119,7 @@ jobs:
|
|||||||
file: build/Dockerfile
|
file: build/Dockerfile
|
||||||
context: '.'
|
context: '.'
|
||||||
target: local
|
target: local
|
||||||
platforms: linux/arm,linux/arm64,linux/amd64,linux/ppc64le,linux/s390x
|
platforms: linux/arm,linux/arm64,linux/amd64,linux/ppc64le,linux/s390x,linux/mips64le,linux/386
|
||||||
tags: |
|
tags: |
|
||||||
nginx/nginx-prometheus-exporter:latest
|
nginx/nginx-prometheus-exporter:latest
|
||||||
nginx/nginx-prometheus-exporter:${{ steps.get_version.outputs.GIT_TAG }}
|
nginx/nginx-prometheus-exporter:${{ steps.get_version.outputs.GIT_TAG }}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
FROM golang:1.16-alpine as builder
|
FROM golang:1.16 as base
|
||||||
ARG VERSION
|
ARG VERSION
|
||||||
ARG GIT_COMMIT
|
ARG GIT_COMMIT
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
@ -9,20 +9,23 @@ COPY vendor ./vendor
|
|||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
COPY collector ./collector
|
COPY collector ./collector
|
||||||
COPY client ./client
|
COPY client ./client
|
||||||
|
|
||||||
|
FROM base as builder
|
||||||
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 .
|
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 as base
|
FROM scratch as intermediate
|
||||||
|
COPY --from=base /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||||
USER 1001:1001
|
USER 1001:1001
|
||||||
ENTRYPOINT [ "/usr/bin/nginx-prometheus-exporter" ]
|
ENTRYPOINT [ "/usr/bin/nginx-prometheus-exporter" ]
|
||||||
|
|
||||||
|
|
||||||
FROM base as container
|
FROM intermediate as container
|
||||||
COPY --from=builder /go/src/github.com/nginxinc/nginx-prometheus-exporter/nginx-prometheus-exporter /usr/bin/
|
COPY --from=builder /go/src/github.com/nginxinc/nginx-prometheus-exporter/nginx-prometheus-exporter /usr/bin/
|
||||||
|
|
||||||
|
|
||||||
FROM base as local
|
FROM intermediate as local
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
ARG TARGETVARIANT
|
ARG TARGETVARIANT
|
||||||
|
|
||||||
COPY dist/nginx-prometheus-exporter_linux_$TARGETARCH${TARGETVARIANT:+_7}/nginx-prometheus-exporter /usr/bin
|
COPY dist/nginx-prometheus-exporter_linux_$TARGETARCH${TARGETVARIANT:+_7}*/nginx-prometheus-exporter /usr/bin/
|
||||||
|
Reference in New Issue
Block a user