This repository has been archived by the owner on Oct 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
69 lines (52 loc) · 2.21 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
include .env
APP_NAME = MySQL in docker compose
SHELL ?= /bin/bash
ARGS = $(filter-out $@,$(MAKECMDGOALS))
DIR = $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
DIR2 = $(notdir $(shell pwd)) ## just in case for history
.SILENT: ; # no need for @
.ONESHELL: ; # recipes execute in same shell
.NOTPARALLEL: ; # wait for this target to finish
.EXPORT_ALL_VARIABLES: ; # send all vars to shell
Makefile: ; # skip prerequisite discovery
# Run make help by default
.DEFAULT_GOAL = help
ifneq ("$(wildcard ./VERSION)","")
VERSION ?= $(shell cat ./VERSION | head -n 1)
else
VERSION ?= 8.0
endif
.env:
cp [email protected] $@
up: ## Starts and attaches to containers for a service
docker compose up -d
down: ## Down all containers.
docker compose down
start: ## Start containers.
docker compose start
stop: ## Stop containers.
docker compose stop
reset: down up
bash: ## Go to the application container.
docker compose exec php sh
mysql: ## Start MySQL client.
docker compose exec mysql mysql -u$(MYSQL_USER) -p$(MYSQL_PASSWORD) $(ARGS)
mysqldump: ## MySQL Dump tool
docker compose exec mysql mysqldump -u$(MYSQL_USER) -p$(MYSQL_PASSWORD) $(ARGS)
help: ## Show this help and exit
$(info $(APP_NAME) v$(VERSION))
echo ''
printf " %s: \033[94m%s\033[0m \033[90m[%s] [%s]\033[0m\n" "Usage" "make" "target" "ENV_VARIABLE=ENV_VALUE ..."
echo ''
echo ' Available targets:'
# Print all commands, which have '##' comments right of it's name.
# Commands gives from all Makefiles included in project.
# Sorted in alphabetical order.
echo ' ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
grep -hE '^[a-zA-Z. 0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | \
awk 'BEGIN {FS = ":.*?## " }; {printf "\033[36m%+18s\033[0m: %s\n", $$1, $$2}'
echo ' ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
echo ''
# Show provision flow
%:
@: