-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
125 lines (91 loc) · 2.34 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
DOCK=docker-compose
RUN=$(DOCK) run --rm api
EXEC=$(DOCK) exec api
SF=$(RUN) bin/console
FRONT_NPM=cd apps/front && npm
DB_PORT=3306
install: build api-build front-build
lint: api-lint front-lint
test: api-test front-test
############################### API
api-build: api-vendor-install api-db-create api-db-schema-update
api-config:
@echo "Configuring API authentication..."
@echo ""
- $(RUN) mkdir -p config/jwt
- $(RUN) openssl genpkey -out config/jwt/private.pem -aes256 -algorithm rsa -pkeyopt rsa_keygen_bits:4096
- $(RUN) openssl pkey -in config/jwt/private.pem -out config/jwt/public.pem -pubout
api-load-fixtures:
$(RUN) bin/console doctrine:fixtures:load
# Application control
api-start: api-up db-wait
@echo " => API available on http://localhost:8000"
@echo " => PMA available on http://localhost:8889"
api-stop:
$(DOCK) stop
api-restart: api-stop api-start
api-up:
$(DOCK) up -d
# Vendors management commands
api-vendor-install:
$(RUN) composer install
api-vendor-update:
$(RUN) composer update
api-vendor-clear:
- rm -rf vendor
api-vendor-require:
$(RUN) composer require $(lib)
api-vendor-require-dev:
$(RUN) composer require --dev $(lib)
# Symfony commands
api-db-create:
$(SF) doctrine:database:create --if-not-exists
api-db-schema-update:
$(SF) doctrine:schema:update --force
api-make-entity:
$(SF) make:entity
api-db-make-migration:
$(SF) make:migration
api-db-migrate:
$(SF) doctrine:migrations:migrate
api-db-remove:
$(SF) doctrine:database:drop --force --if-exists
api-db-reset: db-remove db
api-test:
$(RUN) composer test
api-lint:
- $(RUN) composer stan
- $(RUN) composer cscheck
api-cc:
- $(SF) cache:clear
- $(SF) liip:imagine:cache:remove
api-clean:
- rm -rf var/cache/*
- rm -rf var/logs/*
- rm -rf var/sessions/*
api-perm:
- $(EXEC) chmod 777 -R var
$(EXEC) chmod 777 -R vendor
############################### FRONT
front-build:
- cd apps/front && npm i
front-start:
- cd apps/front && npm run dev
front-generate:
- cd apps/front && npm run generate
front-lint:
- cd apps/front && npm run lint
front-test:
- cd apps/front && npm run test
front-deploy:
- cd apps/front && npm run deploy
# ----------------------------
# Internals
build:
$(DOCK) build
db-wait: # Wait for database connection
$(RUN) php -r "for(;;){if(@fsockopen('db',$(DB_PORT))){break;}}"
remove:
$(DOCK) rm -vf
ssh:
$(EXEC) bash