You've already forked nginx_exporter
mirror of
https://github.com/nginxinc/nginx-prometheus-exporter.git
synced 2025-07-30 10:03:04 +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
|
||||
context: '.'
|
||||
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-to: type=local,dest=/tmp/.buildx-cache
|
||||
tags: nginx/nginx-prometheus-exporter:${{ github.sha }}
|
||||
@ -119,7 +119,7 @@ jobs:
|
||||
file: build/Dockerfile
|
||||
context: '.'
|
||||
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: |
|
||||
nginx/nginx-prometheus-exporter:latest
|
||||
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 GIT_COMMIT
|
||||
ARG TARGETARCH
|
||||
@ -9,20 +9,23 @@ COPY vendor ./vendor
|
||||
COPY go.mod go.sum ./
|
||||
COPY collector ./collector
|
||||
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 .
|
||||
|
||||
|
||||
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
|
||||
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/
|
||||
|
||||
|
||||
FROM base as local
|
||||
FROM intermediate as local
|
||||
ARG TARGETARCH
|
||||
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