@@ -27,11 +27,11 @@ logs: ## Show logs of timetracker_ui.
2727
2828.PHONY : stop
2929stop : # # Stop container timetracker_ui.
30- docker-compose stop
30+ docker-compose stop
3131
3232.PHONY : restart
3333restart : # # Restart container timetracker_ui.
34- docker-compose stop
34+ docker-compose stop
3535 docker-compose up -d
3636
3737.PHONY : remove
@@ -44,17 +44,17 @@ test: ## Run all tests on docker container timetracker_ui.
4444 docker exec -it timetracker_ui bash -c " npm run test"
4545
4646.PHONY : publish
47- publish : # # Publish the container image timetracker_ui.
48- docker tag timetracker_ui:latest $(registry_url ) /timetracker_ui:latest
49- docker push $(registry_url ) /timetracker_ui:latest
47+ publish : require-acr-arg require-image_tag-arg # # Upload a docker image to the stage azure container registry acr=<name_of_the_azure_container_registry> image_tag=<tag_for_the_image>
48+ docker tag timetracker_ui:latest $(acr ) .azurecr.io /timetracker_ui:$( image_tag )
49+ docker push $(acr ) .azurecr.io /timetracker_ui:$( image_tag )
5050
5151.PHONY : build_prod
5252build_prod : # # Create docker image with dependencies needed for production.
5353 docker build --target production -t timetracker_ui_prod -f Dockerfile .
5454
5555.PHONY : run_prod
5656run_prod : # # Execute timetracker_ui_prod docker container.
57- docker run -d -p 4200:4200 --name timetracker_ui_prod timetracker_ui_prod
57+ docker run -d -p 4200:4200 --name timetracker_ui_prod timetracker_ui_prod
5858
5959.PHONY : stop_prod
6060stop_prod : # # Stop container timetracker_ui_prod.
@@ -66,10 +66,27 @@ remove_prod: ## Delete container timetracker_ui_prod.
6666 docker rm timetracker_ui_prod
6767
6868.PHONY : publish_prod
69- publish_prod : # # Publish the container image timetracker_ui_prod.
70- docker tag timetracker_ui_prod:latest $(registry_url ) /timetracker_ui_prod:latest
71- docker push $(registry_url ) /timetracker_ui_prod:latest
69+ publish_prod : require-acr-arg require-image_tag-arg # # Upload a docker image to the prod azure container registry acr=<name_of_the_azure_container_registry> image_tag=<tag_for_the_image>
70+ docker tag timetracker_ui_prod:latest $(acr ) .azurecr.io/timetracker_ui: $( image_tag )
71+ docker push $(acr ) .azurecr.io/timetracker_ui: $( image_tag )
7272
7373.PHONY : login
7474login : # # Login in respository of docker images.
7575 az acr login --name $(container_registry )
76+
77+ .PHONY : release
78+ release : require-VERSION-arg require-COMMENT-arg # # Creates an pushes a new tag.
79+ git tag -a ${VERSION} -m " ${COMMENT} "
80+ git push origin ${VERSION}
81+
82+ require-% -arg :
83+ @if [ -z ${${* } } ]; then \
84+ echo "ERROR : [$* ] argument is required, e.g. $* =<value>"; \
85+ exit 1; \
86+ fi
87+
88+ require-% -tool :
89+ @if [ " $( shell command -v ${* } 2> /dev/null) " = " " ]; then \
90+ echo "ERROR : [$* ] not found"; \
91+ exit 1; \
92+ fi
0 commit comments