mirror of
https://github.com/zalando-incubator/kube-metrics-adapter.git
synced 2024-12-22 19:16:06 +00:00
1daacb0873
Signed-off-by: Mikkel Oscar Lyderik Larsen <mikkel.larsen@zalando.de>
43 lines
1.2 KiB
Makefile
43 lines
1.2 KiB
Makefile
.PHONY: clean test check build.local build.linux build.osx build.docker build.push
|
|
|
|
BINARY ?= kube-metrics-adapter
|
|
VERSION ?= $(shell git describe --tags --always --dirty)
|
|
IMAGE ?= registry-write.opensource.zalan.do/teapot/$(BINARY)
|
|
TAG ?= $(VERSION)
|
|
SOURCES = $(shell find . -name '*.go')
|
|
DOCKERFILE ?= Dockerfile
|
|
GOPKGS = $(shell go list ./...)
|
|
BUILD_FLAGS ?= -v
|
|
LDFLAGS ?= -X main.version=$(VERSION) -w -s
|
|
|
|
default: build.local
|
|
|
|
clean:
|
|
rm -rf build
|
|
|
|
test:
|
|
go test -v $(GOPKGS)
|
|
|
|
check:
|
|
golint $(GOPKGS)
|
|
go vet -v $(GOPKGS)
|
|
|
|
build.local: build/$(BINARY)
|
|
build.linux: build/linux/$(BINARY)
|
|
build.osx: build/osx/$(BINARY)
|
|
|
|
build/$(BINARY): go.mod $(SOURCES)
|
|
CGO_ENABLED=0 go build -o build/$(BINARY) $(BUILD_FLAGS) -ldflags "$(LDFLAGS)" .
|
|
|
|
build/linux/$(BINARY): go.mod $(SOURCES)
|
|
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build $(BUILD_FLAGS) -o build/linux/$(BINARY) -ldflags "$(LDFLAGS)" .
|
|
|
|
build/osx/$(BINARY): go.mod $(SOURCES)
|
|
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build $(BUILD_FLAGS) -o build/osx/$(BINARY) -ldflags "$(LDFLAGS)" .
|
|
|
|
build.docker: build.linux
|
|
docker build --rm -t "$(IMAGE):$(TAG)" -f $(DOCKERFILE) .
|
|
|
|
build.push: build.docker
|
|
docker push "$(IMAGE):$(TAG)"
|