-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
114 lines (94 loc) · 3.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
.PHONY: info init build run test-run install update stop xdebug-init chown php-bash chl chl-first
info:
@echo "LenderKit Server Configuration/Launcher"
@echo " "
@echo "Usage:"
@echo " make command [V=1]"
@echo " "
@echo "Options:"
@echo " V=1 Vagrant mode, use it in Vagrant to prevent permission errors"
@echo " NONE_INTERACTIVE=1 Use it in CI to prevent errors with docker-compose exec\run"
@echo " "
@echo "Available commands:"
@echo " init Init configurations"
@echo " build Build images"
@echo " run channel={channel-uuid} url={forward-url} Run the application in the docker container"
@echo " install Run install process (php and nodejs)"
@echo " update Run install process (php and nodejs)"
@echo " chown Return back correct file owner for files created inside a container"
@echo " php-bash Open php-fpm container bash"
CURDIR_BASENAME = $(notdir ${CURDIR})
MAYBE_SUDO =
ifneq "$(V)" ""
MAYBE_SUDO = sudo
endif
DOCKER_T_FLAG =
ifeq "$(NON_INTERACTIVE)" "1"
DOCKER_T_FLAG = -T
endif
DOCKER_COMPOSE_EXEC = docker-compose exec ${DOCKER_T_FLAG} --privileged
DOCKER_COMPOSE_EXEC_WWW = ${DOCKER_COMPOSE_EXEC} -w /var/www/html
DOCKER_COMPOSE_RUN = docker-compose run -it --rm ${DOCKER_T_FLAG}
CONV_CHL_IMAGE := justcoded/php-conventional-changelog:latest
CONV_CHL_DR := docker run -it --rm --volume "$$PWD":/codebase ${CONV_CHL_IMAGE} bash
CONV_CHL_CMD := conventional-changelog --config changelog.php
############################################
# Make Targets
############################################
init:
@if [ ! -f '.env' ]; then \
echo 'Copying .env file...'; \
${MAYBE_SUDO} cp .env.example .env; \
fi;
@if [ ! -f 'src/.env' ]; then \
echo 'Copying src/.env file...'; \
${MAYBE_SUDO} cp src/.env.example src/.env; \
fi;
@if [ ! -f 'docker-compose.yml' ]; then \
echo 'Copying docker-compose.yml file...'; \
${MAYBE_SUDO} cp docker-compose.example.yml docker-compose.yml; \
fi;
@if [ ! -f 'runtime/bash/.bash_history' ]; then \
echo 'Creating runtime/bash/.bash_history file...'; \
${MAYBE_SUDO} mkdir -pv runtime/bash && ${MAYBE_SUDO} touch runtime/bash/.bash_history; \
fi;
@echo ''
@echo 'NOTE: Please check your configuration in ".env" before run.'
@echo 'NOTE: Please check your configuration in "docker-compose.yml" before run.'
@echo ''
install: build
${DOCKER_COMPOSE_EXEC_WWW} app bash -c "make install"
update:
${DOCKER_COMPOSE_EXEC_WWW} app bash -c "make update"
build:
docker-compose build
build.whp:
${DOCKER_COMPOSE_EXEC_WWW} app bash -c "./whp app:build"
docker compose build whp
run: up
up:
docker compose up -d
xdebug-init:
@if [ $$USER = 'vagrant' ]; then \
export XDEBUG_REMOTE_HOST=`/sbin/ip route|awk '/default/ { print $$3 }'` \
&& echo "Set XDEBUG_REMOTE_HOST to $${XDEBUG_REMOTE_HOST} in .env" \
&& sudo sed -i "s/XDEBUG_REMOTE_HOST=.*/XDEBUG_REMOTE_HOST=$${XDEBUG_REMOTE_HOST}/g" .env; \
fi
test:
@echo 'dummy test'
chown:
sudo chown -R $$(whoami) .env docker-compose.* build/ src/
##
# @command chl Generate changelog based on conventional commits
##
chl:
${CONV_CHL_DR} \
-c "${CONV_CHL_CMD}"
##
# @command chl-first Generate changelog based on conventional commits, first version
##
chl-first:
${CONV_CHL_DR} \
-c "${CONV_CHL_CMD} --first-release"
ssh:
${DOCKER_COMPOSE_EXEC_WWW} app bash