-
Notifications
You must be signed in to change notification settings - Fork 4
/
makefile
69 lines (59 loc) · 2.82 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# The version of the container will be the name of the most recent git tag. Before building a new container,
# please tag the repo with the new version number.
version = $(shell git for-each-ref --sort=-taggerdate --format '%(refname:short)' refs/tags | head -n 1)
.PHONY: all
all: help
.PHONY: clean
clean: ## delete temporary files
# Distribution directory
-rm -rf dist build
# Cached modules downloaded by setuptools
-rm -rf .eggs
# Package metadata
-rm -rf naas.egg-info
# Compiled python
-find naas -name '*.pyc' -o -name '__pycache__' -delete
# Extra stuff installed by pip
-rm -rf share
.PHONY: distclean
distclean: clean ## delete anything that's not part of the repo
git reset HEAD --hard
git clean -fxd
.PHONY: build_check
build_check: ## validate that environment is clean and ready for build
@echo Checking for untagged changes...
test -z "$(shell git status --porcelain)"
git diff-index --quiet $(version)
@echo Repo is clean.
.PHONY: build_tarball
build_tarball: build_check ## build the python sdist tarball of NAAS
@echo Building tarball...
python setup.py sdist
.PHONY: build_container
build_container: build_check ## build the NAAS docker container
@echo Building container...
docker build --pull --build-arg version="$(version)" \
--tag lykinsbd/naas:$(version) \
--tag lykinsbd/naas:latest .
.PHONY: push_container
push_container: ## push the NAAS docker container to Docker Hub
docker push lykinsbd/naas:$(version)
docker push lykinsbd/naas:latest
release: build_tarball build_container push_container ## build tarball and container, push the NAAS docker container to Docker Hub
.PHONY: banner
banner:
@echo ""
@echo " ███▄▄▄▄ ▄████████ ▄████████ ▄████████ "
@echo " ███▀▀▀██▄ ███ ███ ███ ███ ███ ███ "
@echo " ███ ███ ███ ███ ███ ███ ███ █▀ "
@echo " ███ ███ ███ ███ ███ ███ ███ "
@echo " ███ ███ ▀███████████ ▀███████████ ▀███████████ "
@echo " ███ ███ ███ ███ ███ ███ ███ "
@echo " ███ ███ ███ ███ ███ ███ ▄█ ███ "
@echo " ▀█ █▀ ███ █▀ ███ █▀ ▄████████▀ "
@echo " "
@echo ""
.PHONY: help
help: banner
# Help function shamelessly stolen from the Rackspace Engineering Handbook
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'