-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
54 lines (41 loc) · 1.16 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
44
45
46
47
48
49
50
51
52
53
54
PROJECT = kubealived
VERSION = $(shell grep image: manifests/kubealived.yaml | cut -d: -f3)
REGISTRY = quay.io
USER = openvnf
GIT_SHA = $(shell git rev-parse HEAD | cut -c1-8)
IMAGE = $(REGISTRY)/$(USER)/$(PROJECT):$(VERSION)
IMAGE_LATEST = $(REGISTRY)/$(USER)/$(PROJECT):latest
BUILD_ARGS = \
--build-arg PROJECT=$(PROJECT) \
--build-arg VERSION=$(VERSION) \
--build-arg GIT_SHA=$(GIT_SHA)
usage:
@echo "Usage: make <Command>"
@echo
@echo "Commands"
@echo " docker-build"
@echo " docker-push"
@echo " docker-release"
@echo " docker-local-release"
@echo " docker-clean"
@echo " docker-distclean"
@echo
@echo " git-release"
@echo " version"
docker-build:
docker build $(BUILD_ARGS) . -t $(IMAGE)
docker-push:
docker push $(IMAGE)
docker-release: docker-local-release docker-push
docker push $(IMAGE_LATEST)
docker-local-release:
docker tag $(IMAGE) $(IMAGE_LATEST)
docker-clean:
docker system prune -f --filter label=PROJECT=$(PROJECT)
docker-distclean: docker-clean
docker rmi $(IMAGE_LATEST) $(IMAGE) 2>/dev/null || true
git-release:
git tag -a $(VERSION)
git push origin $(VERSION)
version:
@echo "$(VERSION) (git-$(GIT_SHA))"