-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
47 lines (35 loc) · 1.27 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
ID ?= '$(shell which id)'
USER ?= $(shell $(ID) -un)
USER_ID ?= $(shell $(ID) -u)
DOCKER := '$(shell which docker)'
DOCKER_COMPOSE := '$(shell which docker-compose)'
PWD := $(shell which pwd)
APP_DIR ?= $(shell $(PWD))
COMPOSER_CACHE_DIRECTORY ?= $(HOME)/.cache/composer/
ENV ?= "development"
.DEFAULT_GOAL = help
install: .install ## Install all
.PHONY: dc-build
dc-build:
$(call dc-build)
.install: dc-build vendor/autoload.php
$(call dc-build)
> $@
start: .env vendor/autoload.php ## Start project all
$(call up-docker, database php-fpm nginx reverseproxy kibana elasticsearch)
restart: .env vendor/autoload.php ## Restart project all
$(call down-docker)
$(call up-docker, database php-fpm nginx reverseproxy)
vendor/autoload.php/%: ## install compose dependency with % like a dependency(;version) and we can add args with OPTS, like `OPTS="--dev"`.
$(call composer,require $*)
vendor/autoload.php: ## install whole dependencies
$(call composer,install)
.env: ## Configure env
cp .env.dev .env
echo "USER_ID=$(USER_ID)" >> $@
echo "USER=$(USER)" >> $@
echo "COMPOSER_CACHE_DIRECTORY=$(COMPOSER_CACHE_DIRECTORY)" >> $@
echo "APP_DIR=$(APP_DIR)" >> $@
vendor/autoload: .env ## Install dependencies
$(DOCKER-COMPOSE) run --rm composer composer install
include make/helpers.mk