This repository has been archived by the owner on Aug 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
72 lines (57 loc) · 1.59 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
include .env
DEV =docker-compose -f docker-compose.yaml -f docker-compose.override.yaml
DEPLOY =docker-compose -f docker-compose.yaml -f docker-compose.deploy.yaml
WP-CLI =${DEV} run wp-cli
MYSQLAUTH =caching_sha2_password
DB-EXPORT =${WP-CLI} wp db export --default-auth=${MYSQLAUTH} --porcelain
.PHONY: build
build:
${DEV} build
.PHONY: up
up: build
${DEV} up
.PHONY: down
down:
${DEV} down
.PHONY: reset
reset: down up
.PHONY: buildup
buildup: build up
.PHONY: deploy
deploy: build
-${DEV} down
${DEPLOY} up --detach
.PHONY: clear
clear:
-${DEV} down -v
-${DEPLOY} down -v
# ======================================================== $
.PHONY: db-export
db-export:
@${WP-CLI} wp db export $$MYSQLAUTH --porcelain
.PHONY: copy-db
copy-db:
BACKUP_FILE=$(shell make db-export | tail -1);\
cp ./var/backups/$$BACKUP_FILE ./mysql/docker-entrypoint-initdb.d
.PHONY: wp
wp:
${DEV} run wp-cli $(args)
#file=connect
#folder=./tests/python
#args="localhost ${WORDPRESS_PORT} / 200"
.PHONY: test
test: ## make file=connect folder=./tests/python test args="localhost 80 / 200"
docker run --rm --network=host $$(docker build -q --build-arg FILE=$(file).py $(folder)) $(args)
# todo before deployment only local testing script should be run
.PHONY: tests
tests:
./run_tests.sh
.PHONY: crawl-local
crawl-local:
make folder=./tests/python file=crawl test args="http://localhost:${WORDPRESS_PORT}"
.PHONY: wp-cli-up
wp-cli-up: ## wp-cli up build
${DEV} up --build wp-cli
.PHONY: help
help:
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z0-9_-]+:.*?## / {printf "\033[36m%-16s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)