-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
43 lines (32 loc) · 1.05 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
PROJECT ?= leanix-k8s-connector
DOCKER_NAMESPACE ?= leanixacrpublic.azurecr.io
VERSION := 6.5.1
VERSION_LATEST := 6.latest
FULL_VERSION := $(VERSION)-$(shell git describe --tags --always)
IMAGE := $(DOCKER_NAMESPACE)/$(PROJECT):$(VERSION)
IMAGE_LATEST := $(DOCKER_NAMESPACE)/$(PROJECT):$(VERSION_LATEST)
FULL_IMAGE := $(DOCKER_NAMESPACE)/$(PROJECT):$(FULL_VERSION)
LATEST := $(DOCKER_NAMESPACE)/$(PROJECT):latest
GOOS ?= linux
GOARCH ?= amd64
.PHONY: all
all: clean test build
clean:
$(RM) bin/$(PROJECT)
build:
CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o bin/$(PROJECT) -ldflags '-extldflags "-static"' ./cmd/$(PROJECT)/main.go
version:
@echo $(VERSION)
gen:
go mod download
go install github.com/vektra/mockery/[email protected]
mockery --all --recursive --with-expecter --case=underscore --output ./pkg/mocks
image:
docker build --no-cache --pull --rm -t $(IMAGE) -t $(FULL_IMAGE) -t $(LATEST) -t $(IMAGE_LATEST) .
push:
docker push $(IMAGE)
docker push $(FULL_IMAGE)
docker push $(LATEST)
docker push $(IMAGE_LATEST)
test:
go test ./pkg/...