forked from Graffino/Graffino-Docker-Ninja
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
125 lines (104 loc) · 2.81 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
115
116
117
118
119
120
121
122
123
124
include .env
export
CONTAINER_NGINX=docker compose exec -T nginx sh -c
CONTAINER_PHP=docker compose exec -T php-fpm sh -c
CONTAINER_MARIADB=docker compose exec -T mariadb sh -c
.PHONY: start
start:
docker compose up -d
.PHONY: stop
stop:
docker compose -f docker-compose.yml down
.PHONY: setup
setup:
make permissions
docker network create proxy || true
docker compose up --build -d
$(CONTAINER_PHP) 'yarn node:install'
$(CONTAINER_PHP) 'yarn composer:install'
$(CONTAINER_PHP) 'yarn wp:clean --no-confirm'
$(CONTAINER_PHP) 'yarn wp:db:init --no-confirm'
$(CONTAINER_PHP) 'yarn wp:db:migrate --no-confirm'
$(CONTAINER_PHP) 'yarn wp:uploads:symlink --no-confirm'
$(CONTAINER_PHP) 'yarn webpack:wp:build'
.PHONY: staging
staging:
make production
.PHONY: staging-test
staging-test:
make production
$(CONTAINER_PHP) 'yarn lint'
.PHONY: production
production:
make permissions
docker compose up -d
$(CONTAINER_PHP) 'yarn node:install'
$(CONTAINER_PHP) 'yarn composer:install'
$(CONTAINER_PHP) 'yarn wp:clean --no-confirm'
$(CONTAINER_PHP) 'yarn wp:db:init --no-confirm'
$(CONTAINER_PHP) 'yarn wp:db:migrate --no-confirm'
$(CONTAINER_PHP) 'yarn wp:uploads:symlink --no-confirm'
$(CONTAINER_PHP) 'yarn webpack:wp:build'
.PHONY: composer
composer:
$(CONTAINER_PHP) 'composer install'
.PHONY: fix
fix:
$(CONTAINER_PHP) 'yarn fix'
.PHONY: test
test:
$(CONTAINER_PHP) 'yarn lint'
.PHONY: permissions
permissions:
mkdir -p .docker/logs/cron/ .docker/logs/nginx/ .docker/logs/mariadb docker/logs/php-fpm/
chmod -R 777 .docker/logs/
.PHONY: reset
reset:
docker compose -f docker-compose.yml down
docker system prune --force
rm -rf ./.docker/logs/cron/*
rm -rf ./.docker/logs/mariadb/*
rm -rf ./.docker/logs/nginx/*
rm -rf ./.docker/logs/php-fpm/*
rm -rf ./node_modules/
rm -rf ./.cache/
rm -rf ./composer/
rm -rf ./vendor/
rm -rf ./dist-wp/
rm -rf ./dist/
make setup
.PHONY: clean
clean:
docker compose -f docker-compose.yml down
docker system prune --all --volumes --force
rm -rf ./.docker/logs/cron/*
rm -rf ./.docker/logs/mariadb/*
rm -rf ./.docker/logs/nginx/*
rm -rf ./.docker/logs/php-fpm/*
rm -rf ./node_modules/
rm -rf ./.cache/
rm -rf ./composer/
rm -rf ./vendor/
rm -rf ./dist-wp/
rm -rf ./dist/
.PHONY: clean-force
clean-force:
sudo make clean
.PHONY: ssh-nginx
ssh-nginx:
docker exec -it ${COMPOSE_PROJECT_NAME}-nginx /bin/sh
.PHONY: ssh-php
ssh-php:
docker exec -it ${COMPOSE_PROJECT_NAME}-php-fpm /bin/sh
.PHONY: ssh-mariadb
ssh-mariadb:
docker exec -it ${COMPOSE_PROJECT_NAME}-mariadb /bin/sh
.PHONY: rebuild-nginx
rebuild-nginx:
docker compose up -d --no-deps --force-recreate --build nginx
.PHONY: rebuild-php
rebuild-php:
docker compose up -d --no-deps --force-recreate --build php-fpm
.PHONY: rebuild-mariadb
rebuild-mariadb:
docker compose up -d --no-deps --force-recreate --build mariadb