-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
53 lines (38 loc) · 1.25 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
# Change shell in linux
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S), Linux)
SHELL:=bash
endif
# Get user ID
UID := $(shell id -u)
WORKDIR := /application
DEV_DIR := .
ifndef TARGET_ENVIRONMENT
TARGET_ENVIRONMENT := dev
endif
# Get docker path or an empty string
DOCKER := $(shell command -v docker)
SERVICE_NAME := php-fpm
# Test if the dependencies we need to run this Makefile are installed and creates the common docker network if missing
depend-on-docker:
ifndef DOCKER
@echo "Docker is not available. Please install docker"
@exit 1
endif
uid:
export UID
docker-build: depend-on-docker
docker-compose \
-f docker-compose.yml \
build
run: uid docker-build
docker-compose -f docker-compose.yml up; exit 0
# Run a shell into the development docker image
shell: docker-build
docker run -ti --rm -v $(PWD):$(WORKDIR) -u $(UID):$(UID) --name $(SERVICE_NAME) -p $(PORT):$(PORT) $(REPOSITORY)-dev /bin/bash; exit 0;
test: depend-on-docker
docker-compose -f docker-compose.yml exec $(SERVICE_NAME) /application/vendor/bin/phpunit
start-php-unit-coverage: depend-on-docker
docker-compose -f docker-compose.yml exec $(SERVICE_NAME) /application/vendor/bin/phpunit --coverage
dockers-down: depend-on-docker
docker-compose -f docker-compose.yml down