forked from istex/istex-search
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
40 lines (30 loc) · 1.79 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
.PHONY: build install
.DEFAULT_GOAL := help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
# If the first argument is one of the supported commands...
SUPPORTED_COMMANDS := npm
SUPPORTS_MAKE_ARGS := $(findstring $(firstword $(MAKECMDGOALS)), $(SUPPORTED_COMMANDS))
ifneq "$(SUPPORTS_MAKE_ARGS)" ""
# use the rest as arguments for the command
COMMAND_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
# ...and turn them into do-nothing targets
$(eval $(COMMAND_ARGS):;@:)
endif
install: ## install depedencies thanks to a dockerized npm install
@docker run -it --rm -v $$(pwd):/app -w /app --net=host -e NODE_ENV -e http_proxy -e https_proxy node:8.4.0 npm install -q
@make chown
build: ## build the docker istex/istex-dl image locally
@docker build -t istex/istex-dl --build-arg http_proxy --build-arg https_proxy .
run: ## run istex-dl in production mode
@docker-compose -f ./docker-compose.yml up -d
@tail -f -n 0 ./logs/*.log
# makefile rule used to keep current user's unix rights on the docker mounted files
chown:
@test ! -d $$(pwd)/node_modules || docker run -it --rm --net=host -v $$(pwd):/app node:8.4.0 chown -R $$(id -u):$$(id -g) /app/
@test ! -d $$(pwd)/www/node_modules || docker run -it --rm --net=host -v $$(pwd)/www:/app node:8.4.0 chown -R $$(id -u):$$(id -g) /app/
npm: ## npm wrapper. example: make npm install --save mongodb-querystring
@docker run -it --rm -v $$(pwd):/app -w /app --net=host -e NODE_ENV -e http_proxy -e https_proxy node:8.4.0 npm $(filter-out $@,$(MAKECMDGOALS))
@make chown
lint: ## checks the coding rules (in a dockerized process)
@docker run -it --rm -v $$(pwd):/app -w /app -e NODE_ENV -e http_proxy -e https_proxy node:8.4.0 npm run lint