forked from Kirouane/ensiie-project
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathMakefile
44 lines (33 loc) · 1.2 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
bold=$(shell (tput bold))
normal=$(shell (tput sgr0))
.DEFAULT_GOAL=help
DISTRIB:=$(shell lsb_release -is | tr '[:upper:]' '[:lower:]')
VERSION:=$(shell lsb_release -cs)
ARCHITECTURE:=$(shell dpkg --print-architecture)
help:
@echo "${bold}install${normal}\n\t Installs the whole appplication.\n"
@echo "${bold}uninstall${normal}\n\t Stops and removes all containers and drops the database.\n"
@echo "${bold}start${normal}\n\t Starts the application.\n"
@echo "${bold}db.connect${normal}\n\t Connects to the database.\n"
@echo "${bold}phpunit.run${normal}\n\t Runs the unit tests.\n"
start:
docker-compose up --build -d
sleep 3
stop:
docker-compose down -v
docker-compose rm -v
install: uninstall start composer.install db.install
uninstall: stop
@sudo rm -rf postgres-data
reinstall: install
#Connects to the databatase
db.connect:
docker-compose exec postgres /bin/bash -c 'psql -U $$POSTGRES_USER'
db.install:
docker-compose exec postgres /bin/bash -c 'psql -U $$POSTGRES_USER -h localhost -f data/db.sql'
php.connect:
docker-compose exec php /bin/bash
phpunit.run:
docker-compose exec php vendor/bin/phpunit --config=phpunit.xml
composer.install:
docker-compose exec php composer install || exit 0