File tree Expand file tree Collapse file tree 6 files changed +102
-5
lines changed Expand file tree Collapse file tree 6 files changed +102
-5
lines changed Original file line number Diff line number Diff line change 1+ name : build-unbound_explorer
2+ on :
3+ create :
4+ tags :
5+ - ^v\d{1,}\.\d{1,}\.\d{1,}$
6+
7+ jobs :
8+ build :
9+ runs-on : ubuntu-18.04
10+ env :
11+ CONTAINER_IMAGE : ghcr.io/${{github.repository}}
12+ DOCKER_VERSION : ${{github.ref_name}}
13+ DOCKER_TARGET_PLATFORM : linux/arm64,linux/amd64
14+ steps :
15+ -
16+ id : checkout
17+ name : Checkout the code
18+ uses : actions/checkout@v2
19+ -
20+ id : install-qemu
21+ name : Set up QEMU
22+ uses : docker/setup-qemu-action@v1
23+ -
24+ id : install-buildx
25+ name : Set up Docker Buildx
26+ uses : docker/setup-buildx-action@v1
27+ with :
28+ install : true
29+ -
30+ id : login-registry
31+ name : Log into registry
32+ run : |
33+ echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} \
34+ --password-stdin
35+ -
36+ id : build
37+ name : Build
38+ run : |
39+ docker build \
40+ --platform ${DOCKER_TARGET_PLATFORM} \
41+ --tag ${CONTAINER_IMAGE}:${DOCKER_VERSION} \
42+ --push \
43+ .
Original file line number Diff line number Diff line change 1- unbound_exporter
21.idea /
2+ _out /*
3+ ! _out /.keep
Original file line number Diff line number Diff line change 1+ FROM golang:1.17-alpine3.14 AS builder
2+
3+ RUN apk add --no-cache \
4+ build-base \
5+ make \
6+ curl
7+
8+ WORKDIR /workspace
9+ RUN mkdir _out
10+
11+ COPY go.mod go.sum Makefile unbound_exporter.go ./
12+ RUN make clean-compile
13+
14+ FROM scratch
15+ COPY --from=builder /workspace/_out/unbound_explorer /usr/local/bin/unbound_exporter
16+
17+ ENTRYPOINT ["unbound_exporter" ]
Original file line number Diff line number Diff line change 1+ SHELL := /bin/sh
2+ OUT := $(shell pwd) /_out
3+ BUILDARCH := $(shell uname -m)
4+ GCC := $(OUT ) /$(BUILDARCH ) -linux-musl-cross/bin/$(BUILDARCH ) -linux-musl-gcc
5+ LD := $(OUT ) /$(BUILDARCH ) -linux-musl-cross/bin/$(BUILDARCH ) -linux-musl-ld
6+
7+ clean-compile : musl deps compile
8+
9+ compile :
10+ CGO_ENABLED=1 \
11+ CC_FOR_TARGET=$(GCC ) \
12+ CC=$(GCC ) \
13+ go build \
14+ -ldflags ' -linkmode external -extldflags -static' \
15+ -a -o _out/unbound_explorer .
16+
17+ deps :
18+ go mod tidy -v
19+ go mod download
20+
21+ musl : clean
22+ (cd $( OUT) ; curl -LOk https://musl.cc/$( BUILDARCH) -linux-musl-cross.tgz)
23+ tar zxf $(OUT ) /$(BUILDARCH ) -linux-musl-cross.tgz -C $(OUT )
24+
25+ clean :
26+ rm -Rf $(OUT ) $(BINARY_NAME )
27+ mkdir -p $(OUT )
28+ touch $(OUT ) /.keep
Original file line number Diff line number Diff line change 11module github.com/letsencrypt/unbound_exporter
22
3- go 1.16
3+ go 1.17
44
55require (
6- github.com/cespare/xxhash/v2 v2.1.2 // indirect
76 github.com/go-kit/log v0.2.0
8- github.com/golang/protobuf v1.5.2 // indirect
9- github.com/google/go-cmp v0.5.6 // indirect
107 github.com/prometheus/client_golang v1.11.0
118 github.com/prometheus/common v0.32.1
9+ )
10+
11+ require (
12+ github.com/beorn7/perks v1.0.1 // indirect
13+ github.com/cespare/xxhash/v2 v2.1.2 // indirect
14+ github.com/go-logfmt/logfmt v0.5.1 // indirect
15+ github.com/golang/protobuf v1.5.2 // indirect
16+ github.com/google/go-cmp v0.5.6 // indirect
17+ github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
18+ github.com/pkg/errors v0.9.1 // indirect
19+ github.com/prometheus/client_model v0.2.0 // indirect
1220 github.com/prometheus/procfs v0.7.3 // indirect
1321 golang.org/x/sys v0.0.0-20211112193437-faf0a1b62c6b // indirect
1422 google.golang.org/protobuf v1.27.1 // indirect
You can’t perform that action at this time.
0 commit comments