-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
69 lines (50 loc) · 2.14 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Makefile focusing on Docker
DOCKER_COMPOSE = docker-compose
EXEC = $(DOCKER_COMPOSE) exec -T php /usr/local/bin/entrypoint
##
###------------#
### Help #
###------------#
##
.DEFAULT_GOAL := help
help: ## DEFAULT_GOAL : Display help messages from parent Makefile
@grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-20s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'
.PHONY: help
##
###----------------------------------#
### Project commands (Docker) #
###----------------------------------#
##
exec\:%: ## Calling Symfony console
$(EXEC) $* $(ARGS)
build: ./docker-compose.yml ./docker-compose.override.yml.dist ## Build Docker images
@if [ -f ./docker-compose.override.yml ]; \
then \
echo '\033[1;41m/!\ The ./docker-compose.override.yml already exists. So delete it, if you want to reset it.\033[0m'; \
else \
cp ./docker-compose.override.yml.dist ./docker-compose.override.yml; \
echo '\033[1;42m/!\ The ./docker-compose.override.yml was just created. Feel free to put your config in it.\033[0m'; \
fi
$(DOCKER_COMPOSE) pull --quiet --ignore-pull-failures 2> /dev/null
$(DOCKER_COMPOSE) build --force-rm --compress
start: ## Start all containers
$(DOCKER_COMPOSE) up -d --remove-orphans --no-recreate
stop: ## Stop all containers
$(DOCKER_COMPOSE) stop
install: build start composer ## Launch project : Build Docker and start the project with vendors
kill: ## Kill Docker containers
$(DOCKER_COMPOSE) kill
$(DOCKER_COMPOSE) down --volumes --remove-orphans
clear: kill rmi ## Remove all containers and images
rmi: ## Remove all images (<none> too)
docker image prune -fa
reset: clear build ## Alias coupling clear and build rules
.PHONY: build start stop install kill clear rmi reset
##
###------------#
### Vendor #
###------------#
##
composer: ## Install vendor/
$(DOCKER_COMPOSE) exec -T php /usr/local/bin/entrypoint composer install -d ./app/ --prefer-dist --no-progress
.PHONY: composer