forked from 0mars/clean-architecture-symfony
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
37 lines (24 loc) · 1.18 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
# parse target arguments
TARGET_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
$(eval $(TARGET_ARGS):;@:)
-include .env
help: ## Show this help, Assumption there is an app container called 'web'
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
# containers
start: ## start the application
docker-compose up -d
stop: ## stop the application
docker-compose stop
rebuild: ## build a container (e.g. make rebuild web)
docker-compose build --force-rm $(TARGET_ARGS)
restart: ## restart a container
docker-compose stop $(TARGET_ARGS) && docker-compose start $(TARGET_ARGS)
clean-restart: ## stop, remove, start
docker-compose stop $(TARGET_ARGS) && docker-compose rm -f $(TARGET_ARGS) && make rebuild $(TARGET_ARGS) && make start
logs: ## tail container logs
docker-compose logs -f $(TARGET_ARGS)
bash: ## open a container's bash
docker-compose exec $(TARGET_ARGS) sh
build-php-app: ## builds a php app (make build-php-app myServiceName)
docker-compose exec $(TARGET_ARGS) /bin/bash -c "./composer.phar install"
docker-compose exec $(TARGET_ARGS) /bin/bash -c "make build"