Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
74 lines (56 loc) · 2.71 KB
/
Copy pathMakefile
File metadata and controls
74 lines (56 loc) · 2.71 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
# .env loading (.env.local overrides .env)
ifneq (,$(wildcard ./.env))
include .env
export
endif
ifneq (,$(wildcard ./.env.local))
include .env.local
export
endif
# Executables (local)
DOCKER_COMP = docker compose
# Docker containers
PHP_EXEC = $(DOCKER_COMP) exec php-fpm
PHP_RUN = $(DOCKER_COMP) run --rm php-fpm
# Executables
PHP = $(PHP_EXEC) php
COMPOSER = $(PHP_EXEC) composer
COMPOSER_RUN = $(PHP_RUN) composer
SYMFONY = $(PHP) bin/console
# Misc
.DEFAULT_GOAL = help
.PHONY : help build up start down logs sh composer vendor sf cc test
## —— 🎵 🐳 The Symfony Docker Makefile 🐳 🎵 ——————————————————————————————————
help: ## Outputs this help screen
@awk 'BEGIN {FS = ":.*?## "; } /^[a-zA-Z0-9][a-zA-Z0-9_-]+:.*?## / { printf "\033[36m%-12s\033[0m %s\n", $$1, $$2 } /^## .*$$/ { printf "\033[33m%s\033[0m\n", substr($$0, 4) } ' $(MAKEFILE_LIST)
## —— Docker 🐳 ————————————————————————————————————————————————————————————————
build: ## Builds the Docker images
@$(DOCKER_COMP) build --pull --no-cache
up: ## Start the docker hub in detached mode (no logs)
@$(DOCKER_COMP) up --detach
@echo "You can now access the application at http://localhost:$(NGINX_PORT)"
down: ## Stop the docker hub
@$(DOCKER_COMP) down --remove-orphans
stop: ## Stop services
@$(DOCKER_COMP) stop
start: ## Start services
@$(DOCKER_COMP) start
restart: stop start ## Restart services
sh: ## Connect to the PHP container
@$(PHP_EXEC) sh
init: down build install up ## Build / rebuild application
## —— 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
install: ## Install dependencies without running the whole application.
${COMPOSER_RUN} install
## —— 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