-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
100 lines (72 loc) · 3.87 KB
/
Makefile
File metadata and controls
100 lines (72 loc) · 3.87 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# Executables (local)
DOCKER_COMP = docker compose
# Docker containers
PHP_CONT = $(DOCKER_COMP) exec -e COMPOSER_MEMORY_LIMIT=-1 php
# Executables
PHP = $(PHP_CONT) php -d memory_limit=-1
COMPOSER = $(PHP_CONT) composer
SYMFONY = $(PHP) bin/console
PHPUNIT = $(PHP) bin/phpunit
# Node.js / npm
NODE = $(PHP_CONT) node
NPM = $(PHP_CONT) npm
# Misc
.DEFAULT_GOAL = help
.PHONY : help build up start down logs sh composer vendor sf cc
## —— 🎵 🐳 The Symfony Docker Makefile 🐳 🎵 ——————————————————————————————————
help: ## Outputs this help screen
@grep -E '(^[a-zA-Z0-9\./_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}{printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'
## —— Docker 🐳 ————————————————————————————————————————————————————————————————
build: ## Builds the Docker images
@$(DOCKER_COMP) -f docker-compose.yml -f docker-compose.dev.yml build #--pull --no-cache
up: ## Start the docker hub in detached mode (no logs)
@$(DOCKER_COMP) -f docker-compose.yml -f docker-compose.dev.yml up --detach
up-build: ## Start the docker hub in detached mode (no logs)
@$(DOCKER_COMP) -f docker-compose.yml -f docker-compose.dev.yml up --build --detach
up-prod: ## Start the docker hub in detached mode (no logs)
@$(DOCKER_COMP) -f docker-compose.yml -f docker-compose.prod.yml up --detach
up-prod-build: ## Start the docker hub in detached mode (no logs)
@$(DOCKER_COMP) -f docker-compose.yml -f docker-compose.prod.yml up --build --detach
start: build up ## Build and start the containers
db-reset: ## reset databases
@echo "Stopping containers..."
@$(DOCKER_COMP) down
@echo "Removing PostgreSQL volume..."
@docker volume rm timer_pgdata || true
@echo "Done. You can now rebuild containers."
stop: ## Stop the docker hub
@$(DOCKER_COMP) stop
down: ## Stop the docker hub
@$(DOCKER_COMP) down --remove-orphans
logs: ## Show live logs
@$(DOCKER_COMP) logs --tail=0 --follow
sh: ## Connect to the PHP FPM container
@$(PHP_CONT) sh
node: ## Check Node.js version inside container
@$(NODE) -v
npm: ## Check npm version inside container
@$(NPM) -v
npm-install: ## Run npm install inside container
@$(NODE_CONT) npm install
perms: ## Connect to the PHP FPM container
@$(PHP_CONT) chown www-data ./var/cache -R
@$(PHP_CONT) chmod 0777 ./var/cache -R
remove-cache: ## Connect to the PHP FPM container
@$(PHP_CONT) rm -rf ./var/cache/dev
@$(PHP_CONT) rm -rf ./var/cache/prod
## —— Composer 🧙 ——————————————————————————————————————————————————————————————
composer: ## Run composer, pass the parameter "c=" to run a given command, example: make composer c='req symfony/orm-pack'
@$(eval c ?=)
@$(COMPOSER) $(c)
vendor: ## Install vendors according to the current composer.lock file
vendor: c=install --prefer-dist --no-dev --no-progress --no-scripts --no-interaction
vendor: composer
## —— Symfony 🎵 ———————————————————————————————————————————————————————————————
phpunit: ## List all Symfony commands or pass the parameter "c=" to run a given command, example: make sf c=about
@$(PHPUNIT)
## —— Symfony 🎵 ———————————————————————————————————————————————————————————————
sf: ## List all Symfony commands or pass the parameter "c=" to run a given command, example: make sf c=about
@$(eval c ?=)
@$(SYMFONY) $(c)
cc: c=c:c ## Clear the cache
cc: sf