added makefile

This commit is contained in:
Josh Burman 2021-08-11 11:29:05 -04:00
parent 4975ab5b2c
commit 36e6ecb824
2 changed files with 32 additions and 1 deletions

View File

@ -0,0 +1,31 @@
.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=measure-solver
branch=$(shell git rev-parse --abbrev-ref HEAD)
tag=$(shell echo $(branch) | grep -Eo 'feature/([A-Za-z]+-[0-9]*)' | grep -Eo '[A-Za-z]+-[0-9]*' || \
echo $(branch) | grep -Eo '(release|hotfix)/[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+' | grep -Eo '[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+' || \
echo $(branch) | grep -Eo 'QUANT-([[:digit:]]*)')
full: build push
build: ## build the production dockerfile
@if [[ -n "$(tag)" ]]; then \
echo "$(tag)" > docker_tag.txt; \
docker build -t $(repo)/$(project):$(tag) .; \
else \
echo "Nothing to build."; \
fi
push: ## push the production dockerfile
@if [[ -n "$(tag)" ]]; then \
docker push $(repo)/$(project):$(tag); \
else \
echo "Nothing to push."; \
fi
display: ## display the tag/branch values for development testing
@echo "branch: $(branch)"
@echo "tag: $(tag)"

View File

@ -1 +1 @@
0.1 QUANT-987