-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
39 lines (31 loc) · 1020 Bytes
/
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
DOCKERFLAGS := --rm -v $(CURDIR):/app:rw -w /app
BUILD_DEV_IMAGE_PATH := golang:1.16.3-buster
IMAGE_PATH := snigdhasambit/alertmanager-cli
REF_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
export IMAGE_VERSION ?= ${REF_NAME}-$(shell git rev-parse HEAD)
.PHONY: clean
clean:
rm -rf ./bin/*
.PHONY: build
build: clean
GOOS=linux go build -a -o ./bin/alertmanager-cli
.PHONY: build-image
build-image:
docker run $(DOCKERFLAGS) $(BUILD_DEV_IMAGE_PATH) make build
docker build -t $(IMAGE_PATH):$(IMAGE_VERSION) .
.PHONY: tag-image
tag-image:
docker tag $(IMAGE_PATH):$(IMAGE_VERSION) $(IMAGE_PATH):$(IMAGE_VERSION)
.PHONY: push-image
push-image:
docker push $(IMAGE_PATH):$(IMAGE_VERSION)
.PHONY: deploy
deploy:
export IMAGE_VERSION=$(IMAGE_VERSION)
envsubst < deploy/deploy.yml | kubectl apply -f -
.PHONY: docker-lint
docker-lint:
docker run $(DOCKERFLAGS) golangci/golangci-lint:v1.39.0 golangci-lint run -v
.PHONY: docker-test
docker-test:
docker run $(DOCKERFLAGS) $(BUILD_DEV_IMAGE_PATH) make test