From 36e6ecb824ede447d3cf4ca6b111c87d373e39c1 Mon Sep 17 00:00:00 2001 From: Josh Burman Date: Wed, 11 Aug 2021 11:29:05 -0400 Subject: [PATCH] added makefile --- Makefile | 31 +++++++++++++++++++++++++++++++ docker_tag.txt | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e69de29..f174c88 100644 --- a/Makefile +++ b/Makefile @@ -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)" diff --git a/docker_tag.txt b/docker_tag.txt index 49d5957..8a6ce5f 100644 --- a/docker_tag.txt +++ b/docker_tag.txt @@ -1 +1 @@ -0.1 +QUANT-987