diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..d0212405 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM golang:1.10.3-stretch + +# Doing mostly what CI is doing here +RUN apt-get update && \ + apt-get install -y apt-transport-https && \ + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648A4A16A23015EEF4A66B8E4052245BD4284CDD && \ + echo "deb https://repo.iovisor.org/apt/xenial xenial main" > /etc/apt/sources.list.d/iovisor.list && \ + apt-get update && \ + apt-get install -y libbcc=0.6.1-1 linux-headers-amd64 + +ENV GO_PACKAGE=github.com/cloudflare/ebpf_exporter + +COPY ./ /go/src/$GO_PACKAGE + +RUN go install -v $GO_PACKAGE/cmd/... diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..617f1fed --- /dev/null +++ b/Makefile @@ -0,0 +1,16 @@ +RELEASE := $(shell git describe --tags --always --dirty=-dev | sed s'/^v//g') + +RELEASES_DIR := release + +RELEASE_AMD64_DIR := ebpf_exporter-$(RELEASE) +RELEASE_AMD64_BINARY := $(RELEASES_DIR)/$(RELEASE_AMD64_DIR)/ebpf_exporter + +.PHONY: release-binaries +release-binaries: + rm -rf $(RELEASES_DIR)/* + mkdir -p $(RELEASES_DIR)/$(RELEASE_AMD64_DIR) + docker build -t ebpf-exporter-build . + docker run --rm --entrypoint cat ebpf-exporter-build /go/bin/ebpf_exporter > $(RELEASE_AMD64_BINARY) + chmod +x $(RELEASE_AMD64_BINARY) + cd $(RELEASES_DIR) && tar -czf $(RELEASE_AMD64_DIR).tar.gz $(RELEASE_AMD64_DIR) + cd $(RELEASES_DIR) && shasum -a 256 *.tar.gz > sha256sums.txt diff --git a/README.md b/README.md index 3b6c21e3..36aa359e 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,18 @@ To build, you need to have `libbcc` installed: * https://github.com/iovisor/bcc/blob/master/INSTALL.md +You can use pre-compiled binary from Releases: + +* https://github.com/cloudflare/ebpf_exporter/releases + +That still requires you to have `libbcc`. To build release binaries yourself: + +``` +$ make release-binaries +``` + +To build a package from latest sources: + ``` $ mkdir /tmp/ebpf_exporter $ cd /tmp/ebpf_exporter diff --git a/release/.gitignore b/release/.gitignore new file mode 100644 index 00000000..a68d087b --- /dev/null +++ b/release/.gitignore @@ -0,0 +1,2 @@ +/* +!/.gitignore