feat: added a makefile task to build and publish new image version

This commit is contained in:
danilo silva 2020-09-11 10:00:41 +00:00
parent 4282e486e6
commit c7dbc916b3

View file

@ -6,14 +6,29 @@ up: ## Start all the services
start: up install-deps ## Start openpod application start: up install-deps ## Start openpod application
docker-compose exec open-pod iex -S mix phx.server docker-compose exec open-pod iex -S mix phx.server
.PHONY: install-deps
install-deps: container/open-pod ## Install worms dependencies install-deps: container/open-pod ## Install worms dependencies
docker-compose exec open-pod mix deps.get docker-compose exec open-pod mix deps.get
.PHONY: stop
stop: ## Shoutdown services stop: ## Shoutdown services
docker-compose down -v docker-compose down -v
.PHONY: help
help: help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
container/%: container/%:
@docker ps -q --no-trunc --filter status=running | grep $$(docker-compose ps -q $*) >/dev/null 2>&1 || docker-compose up -d $* @docker ps -q --no-trunc --filter status=running | grep $$(docker-compose ps -q $*) >/dev/null 2>&1 || docker-compose up -d $*
.PHONY: build_and_publish
build_and_publish: check-version
@docker build -t openpod/open-pod:latest .
@docker push openpod/open-pod:latest
@docker build -t openpod/open-pod:${VERSION} .
@docker push openpod/open-pod:${VERSION}
check-version:
ifndef VERSION
$(error VERSION is undefined)
endif