braid/Makefile
2019-04-09 10:57:53 -06:00

28 lines
1.0 KiB
Makefile

.PHONY: help
# from https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n\n", $$1, $$2}'
repo=yardstick
project=braid
tag=$(shell git rev-parse --short=7 HEAD)
branch=$(shell git rev-parse --abbrev-ref HEAD)
version=$(shell git describe --exact-match --tags $(git log -n1 --pretty='%h'))
full: build push ## build the docker container completely
build: ## build the production dockerfile
docker build -t $(repo)/$(project):$(tag) \
-t $(repo)/$(project):$(branch) \
.
if git describe --exact-match --tags $(shell git log -n1 --pretty='%h'); then \
docker tag $(repo)/$(project):$(tag) $(repo)/$(project):$(version); \
fi
push: ## push the production dockerfile
docker push $(repo)/$(project):$(tag)
docker push $(repo)/$(project):$(branch)
if git describe --exact-match --tags $(shell git log -n1 --pretty='%h'); then \
docker push $(repo)/$(project):$(version); \
fi