Skip to content

Commit

Permalink
Add goreleaser for building binaries, docker image & packages
Browse files Browse the repository at this point in the history
  • Loading branch information
RubenHoms committed Nov 6, 2020
1 parent a02bdcc commit 9e96138
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 21 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@

# Builds
opensips_exporter
.build/
.tarballs/
dist
53 changes: 53 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
project_name: opensips_exporter

builds:
- id: opensips_exporter
goos:
- linux
goarch:
- amd64
- arm
- arm64
- 386
goarm:
- 5
- 6
- 7

checksum:
name_template: "{{ .ProjectName }}_sha256sums.txt"
algorithm: sha256

dockers:
- goos: linux
goarch: amd64
binaries:
- opensips_exporter
image_templates:
- "voipgrid/opensips_exporter:{{ .Version }}"
- "voipgrid/opensips_exporter:latest"
skip_push: false
dockerfile: Dockerfile
build_flag_templates:
- "--label=org.label-schema.schema-version=1.0"
- "--label=org.label-schema.version={{.Version}}"
- "--label=org.label-schema.name={{.ProjectName}}"

nfpms:
- file_name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Arch }}"
bindir: /usr/bin
vendor: VoIPGRID
homepage: https://www.voipgrid.nl
maintainer: VoIPGRID <info@voipgrid.nl>
license: Apache 2.0
description: Simple server that scrapes OpenSIPS stats and exports them via HTTP for Prometheus consumption
formats:
- apk
- deb
- rpm

release:
github:
owner: voipgrid
name: opensips_exporter
prerelease: auto
19 changes: 0 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,6 @@ staticcheck: $(STATICCHECK)
@echo ">> running staticcheck"
@$(STATICCHECK) -ignore "$(STATICCHECK_IGNORE)" $(pkgs)

build: $(PROMU)
@echo ">> building binaries"
@$(PROMU) build --prefix $(PREFIX)

tarball: $(PROMU)
@echo ">> building release tarball"
@$(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR)

docker:
@echo ">> building docker image from $(DOCKERFILE)"
@docker build --file $(DOCKERFILE) -t "$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" .

docker-test-build:
docker build \
--tag="opensips/opensips:$(OPENSIPS_DOCKER_TAG)" \
Expand All @@ -69,13 +57,6 @@ docker-test-build:
docker-test-start:
docker run -p 8888:8888 -d --name $(NAME) opensips/opensips:$(OPENSIPS_DOCKER_TAG)


$(GOPATH)/bin/promtool promtool:
@GOOS= GOARCH= $(GO) get -u github.com/prometheus/prometheus/cmd/promtool

$(GOPATH)/bin/promu promu:
@GOOS= GOARCH= $(GO) get -u github.com/prometheus/promu

$(GOPATH)/bin/staticcheck:
@GOOS= GOARCH= $(GO) get -u honnef.co/go/tools/cmd/staticcheck

Expand Down

0 comments on commit 9e96138

Please sign in to comment.