From 7c795ce630f1565fdfc48893e634b00421dacbc7 Mon Sep 17 00:00:00 2001 From: Yoan Blanc Date: Tue, 25 May 2021 08:20:18 +0200 Subject: [PATCH] feat: use goreleaser and enable arm64 Signed-off-by: Yoan Blanc --- .goreleaser.yml | 60 +++++++++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 7 +++--- 2 files changed, 63 insertions(+), 4 deletions(-) create mode 100644 .goreleaser.yml diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..0db76a0 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,60 @@ +project_name: beat-exporter + +builds: + - id: beat-exporter + binary: beat-exporter + main: ./main.go + flags: + - -tags="netgo static_build" + env: + - CGO_ENABLED=0 + ldflags: + - -s -w + - -X github.com/prometheus/common/version.Revision={{ .FullCommit }} + - -X github.com/prometheus/common/version.Version={{ .Version }} + - -X github.com/prometheus/common/version.Branch={{ .Tag }} + - -X github.com/prometheus/common/version.BuildDate={{ .Date }} + - -X github.com/prometheus/common/version.BuildUser=goreleaser + goos: + - linux + - darwin + - windows + goarch: + - amd64 + - arm64 + +archives: + - id: tarball + builds: + - beat-exporter + format_overrides: + - goos: windows + format: zip + files: + - none* + +dockers: + - ids: + - beat-exporter + goos: linux + goarch: amd64 + image_templates: + - trustpilot/beat-exporter:latest + - trustpilot/beat-exporter:{{ .Tag }} + - trustpilot/beat-exporter:{{ .Major }}.{{ .Minor }} + - trustpilot/beat-exporter:{{ .Major }} + build_flag_templates: + - "--pull" + - "--label=org.opencontainers.image.created={{ .Date }}" + - "--label=org.opencontainers.image.title={{ .ProjectName }}" + - "--label=org.opencontainers.image.revision={{ .FullCommit }}" + - "--label=org.opencontainers.image.version={{ .Version }}" + +checksum: + ids: + - beat-exporter + +release: + github: + owner: trustpilot + name: beat-exporter diff --git a/Dockerfile b/Dockerfile index a42196d..106b352 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,6 @@ -FROM quay.io/prometheus/busybox:latest -LABEL MAINTAINER="Audrius Karabanovas " +FROM quay.io/prometheus/busybox:uclibc -COPY .build/linux-amd64/beat-exporter /bin/beat-exporter +COPY beat-exporter /usr/local/bin/beat-exporter EXPOSE 9479 -ENTRYPOINT [ "/bin/beat-exporter" ] \ No newline at end of file +ENTRYPOINT [ "beat-exporter" ]