-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
32 lines (24 loc) · 991 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
VERSION=$(shell cat VERSION)
docker-build:
docker build --build-arg VERSION=$(VERSION) -t <registery>:latest .
docker tag <registery>:latest <registery>:$(VERSION)
docker-push:
docker push <registery>:latest
docker push <registery>:$(VERSION)
docker-clean:
docker rmi <registery>:latest || true
docker rmi <registery>:$(VERSION) || true
docker rm -v $(shell docker ps --filter status=exited -q 2>/dev/null) 2>/dev/null || true
docker rmi $(shell docker images --filter dangling=true -q 2>/dev/null) 2>/dev/null || true
check-version-tag:
git pull --tags
if git --no-pager tag --list | grep $(VERSION) -q ; then echo "$(VERSION) already exsits"; exit 1; fi
update-tag:
git pull --tags
if git --no-pager tag --list | grep $(VERSION) -q ; then echo "$(VERSION) already exsits"; exit 1; fi
git tag $(VERSION)
git push origin $(VERSION)
unit-test:
GO111MODULE=on go test -v ./...
test: unit-test
ci-build: check-version-tag docker-build docker-push docker-clean update-tag