Newer
Older
web-services / Makefile
.PHONY: help
.DEFAULT_GOAL := help

USER_ID = $(shell id -u)
GROUP_ID = $(shell id -g)
export UID = $(USER_ID)
export GID = $(GROUP_ID)

help:
	@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

shell: ## Open dockerized Bash terminal
	@docker-compose run --no-deps --rm shell

pycli: ## Open dockerized python command line interface
	@docker-compose run --no-deps --rm shell python3

python: ## Launch PYTHON daemon for one directory,  eg make python ./domains-classifier
	WORKING_DIR="$(filter-out $@,$(MAKECMDGOALS))" docker-compose up --no-deps --force-recreate python

nodejs: ## Launch NODEJS daemon for one directory,  eg make nodejs ./base-line
	WORKING_DIR="$(filter-out $@,$(MAKECMDGOALS))" docker-compose up --no-deps --force-recreate nodejs

reset: ## Reset files permissions for all directory
	@docker-compose run --no-deps --rm shell bash -c "find /app -user daemon -exec chown ${UID}:${GID} {} \;"

version-major: ## Create a major version for a directory, e.g. make version-major mapping-tools
	@./bin/version-major.sh "$(filter-out $@,$(MAKECMDGOALS))"

version-minor: ## Create a minor version for a directory, e.g. make version-minor mapping-tools
	@./bin/version-minor.sh "$(filter-out $@,$(MAKECMDGOALS))"

version-patch: ## Create a patch version for a directory, e.g. make version-patch mapping-tools
	@./bin/version-patch.sh "$(filter-out $@,$(MAKECMDGOALS))"

get-version: ## Get the last version of a directory (useful to deployment)
	@git tag | grep "$(filter-out $@,$(MAKECMDGOALS))" | sort -V | tail -1

examples: ## Launch examples for a directory, e.g. make examples mapping-tools
	@restcli --full "$(filter-out $@,$(MAKECMDGOALS))/examples.http"

example-metadata: ## Give an example metadata, from examples.http, e.g. make example-metadata affiliations-tools 3
	@./bin/generate-example-metadata.mjs $(filter-out $@,$(MAKECMDGOALS))

# Remove error message about lacking rules for targets' parameters
%:
	@: