forked from vend/php-resque
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
67 lines (54 loc) · 1.83 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
# Variables and flags
MAKEFLAGS += --silent
DOCKER_COMPOSE = docker-compose --file docker-compose.yml
WORK_DIRECTORY = app
# Right and OS management
UID := $(shell id -u)
GID := $(shell id -g)
OS := $(shell uname)
# Do not remove - it filters empty arguments from command line
%:
@:
# Help
help:
@echo "Usage:"
@echo " make <COMMAND>"
@echo ""
@echo " Docker commands:"
@echo " ----------------------------------------------------------------------------------------"
@echo " start Start all docker container"
@echo " stop Stop all docker container"
@echo " restart Restart all docker container"
@echo " down Destroy all docker container"
@echo " exec Connect directly to docker container"
@echo " ----------------------------------------------------------------------------------------"
@echo ""
@echo " Test commands:"
@echo " ----------------------------------------------------------------------------------------"
@echo " phpunit, pu Run php unit tests"
@echo " ----------------------------------------------------------------------------------------"
@echo ""
# Docker
start:
@echo "--- Starting docker container ---"
rm -rf dump.rdb
${DOCKER_COMPOSE} up --build -d
${DOCKER_COMPOSE} exec app bash -c "composer install"
@echo "--- Started docker container ---"
stop:
@echo "--- Stopping docker container ---"
${DOCKER_COMPOSE} stop -t1
@echo "--- Stopped docker container ---"
restart: stop start
down:
@echo "--- Destroying docker container ---"
${DOCKER_COMPOSE} down -v
@echo "--- Finished destroying docker container ---"
exec:
@echo "--- Connecting to ${WORK_DIRECTORY} container ---"
${DOCKER_COMPOSE} exec ${WORK_DIRECTORY} bash
# Tests
phpunit pu:
@echo "--- Running php unit tests ---"
${DOCKER_COMPOSE} exec app ./vendor/bin/phpunit
@echo "--- Finished running php unit tests ---"