-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·126 lines (105 loc) · 4.17 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
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
.PHONY: help welcome certificate clean build start stop install goodbye composer-install composer-update db db-update clear docker-clean
.DEFAULT_GOAL: help
include .env.dist
help:
@grep -h -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'
##
#############################
### HELP - MAKEFILE #
#############################
##
##Project
##----------
##
clean:
@if [ -f "docker/containers/nginx/cert/placeholder" ]; \
then \
rm docker/containers/nginx/cert/placeholder; \
fi
build:
@printf '\n##################################\n'
@printf '# BUILD DOCKER SERVICES #\n'
@printf '##################################\n\n'
docker-compose build
start: ## Start the project
@printf '\n##################################\n'
@printf '# START DOCKER CONTAINERS #\n'
@printf '##################################\n\n'
docker-compose up -d
db:
@printf '\n##################################\n'
@printf '# CREATE DB #\n'
@printf '##################################\n'
docker-compose exec php-fpm bin/console doctrine:database:create --if-not-exists
composer-install:
@printf '\n##################################\n'
@printf '# INSTALL DEPENDENCIES #\n'
@printf '##################################\n'
docker run --rm --interactive --tty \
--volume $(PWD)/symfony:/app \
composer install
stop: ## Stop the project
@printf '\n##################################\n'
@printf '# STOP DOCKER CONTAINERS #\n'
@printf '##################################\n\n'
docker-compose stop
restart: stop start ## Restart the project
install: welcome clean .env certificate build start composer-install db goodbye ## Install the project
welcome:
@printf '##################################\n'
@printf '# INSTALL SF STARTER PROJ #\n'
@printf '##################################\n'
goodbye:
@printf '\nPROJECT IS NOW INSTALLED...\n\n'
@printf '##################################\n'
@printf '# READY TO CODE! #\n'
@printf '##################################\n\n'
##
##
##Utils
##----------
##
db-update: ## Update database
@printf '\n##################################\n'
@printf '# UPDATE DATABASE #\n'
@printf '##################################\n'
docker-compose exec php-fpm bin/console make:migration
docker-compose exec php-fpm bin/console doctrine:migrations:migrate
composer-update: ## Update PHP dependencies
@printf '\n##################################\n'
@printf '# UPDATE DEPENDENCIES #\n'
@printf '##################################\n'
docker run --rm --interactive --tty \
--volume $(PWD)/symfony:/app \
composer update
clear: ## Clear cache
@printf '\n##################################\n'
@printf '# CLEAR CACHE #\n'
@printf '##################################\n'
docker-compose exec php-fpm bin/console cache:clear --env=dev
docker-clean: ## Stop containers, remove all containers and images
@printf '\n##################################\n'
@printf '# DOCKER CLEANUP #\n'
@printf '##################################\n'
docker stop $$(docker ps -aq) && docker rm $$(docker ps -aq) && docker rmi $$(docker images -q)
certificate: ## Create self-signed certificate
@if [ ! -f "docker/containers/nginx/cert/selfsigned-cert.key" ]; \
then \
echo "##################################"; \
echo "# CREATE SELF-SIGNED CERTIFICATE #"; \
echo "##################################"; \
echo "openssl genrsa -out selfsigned-cert.key 4096"; \
echo "openssl req -new -x509 -sha256 -subj '/C=FR/ST=Occitanie/L=Montpellier/CN=$(APP_SERVER_ALIAS)' -days 3650 -key selfsigned-cert.key -out selfsigned-cert.crt"; \
cd docker/containers/nginx/cert; \
openssl genrsa -out selfsigned-cert.key 4096; \
openssl req -new -x509 -sha256 -subj '/C=FR/ST=Occitanie/L=Montpellier/CN=$(APP_SERVER_ALIAS)' -days 3650 -key selfsigned-cert.key -out selfsigned-cert.crt; \
fi
.env: .env.dist
@if [ ! -f ".env" ]; \
then \
echo "cp .env.dist symfony/.env"; \
cp .env.dist symfony/.env; \
echo "cp .env.dist .env"; \
cp .env.dist .env; \
fi
##