-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
Makefile
63 lines (45 loc) · 1.77 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
.PHONY: cache composer-install composer-update create-network help install jwt setup-hosts up update upAll
CONFIG_DIR=api/config
DC=docker-compose
DC_UP=$(DC) up -d
DC_EXEC=$(DC) exec -T php
BIN_CONSOLE=$(DC_EXEC) bin/console
help:
@grep -E '(^[0-9a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-25s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'
cache: ## Clear cache
$(BIN_CONSOLE) cache:clear
composer-install: ## Install composer packages
$(DC_EXEC) composer install --no-progress
composer-update: ## Update composer
$(DC_EXEC) composer update
copy-files-prod: ## Copy prod files to dev
cp .env.prod .env
cp docker-compose.prod.yml docker-compose.yml
create-network: ## Create docker network if not exists
docker network create smersh || true
init-db:
$(BIN_CONSOLE) do:da:dr --force
$(BIN_CONSOLE) do:da:cr
$(BIN_CONSOLE) do:sc:up --force
install: ## Install and setup project
$(MAKE) create-network up jwt composer-install cache
sudo chmod -R 777 api/public/media
initialize: install reset-db ## Initialize and setup the project
jwt: ## Generate jwt
sh ./api/generateJWT.sh
load-data:
$(BIN_CONSOLE) ha:fi:load --quiet
reset-db: init-db load-data
setup-hosts:
@echo "Setup hosts..."
@(grep -q -F "127.0.0.1 smersh.lan api.smersh.lan bitwarden.smersh.lan www.smersh.lan codimd.smersh.lan" /etc/hosts) || \
(echo "127.0.0.1 smersh.lan api.smersh.lan bitwarden.smersh.lan www.smersh.lan codimd.smersh.lan" | sudo tee -a /etc/hosts > /dev/null)
up: ## Start containers
$(DC_UP) client api
update-db-schema: ## Update database schema
$(BIN_CONSOLE) do:sc:up --force
update: ## Update containers composer packages then re-up containers
$(DC) pull
$(MAKE) composer-update
$(MAKE) up
upAll: up install init-db load-data