-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
65 lines (53 loc) · 2.75 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
-include .env
# Show available make commands.
usage:
@echo "Please supply one of:"
@echo "\tenv\n\t\t- Copies .env.dist to .env"
@echo "\tsetup\n\t\t- Prepares WordPress folders and installs WordPress."
@echo "\tbuild\n\t\t- Rebuilds the WordPress Docker image."
@echo "\tup\n\t\t- Run WordPress services with 'docker-compose up'."
@echo "\tdown\n\t\t- Stops WordPress services with 'docker-compose down'."
# env copies the environment variables.
env:
cp .env.dist .env
# setup prepares your project and installs WordPress.
setup:
@docker-compose --log-level CRITICAL up -d wordpress-php 2>/dev/null
@docker-compose exec -w /app/wordpress wordpress-php composer install
@docker-compose exec -w /app/wordpress/core wordpress-php wp core download --skip-content
ifneq (${WP_MULTISITE},true)
@echo "Running WordPress single site installation..."
@docker-compose exec -w /app/wordpress/core wordpress-php sh -c 'wp core install --url="${WP_DOMAIN}" --admin_user="${WP_USER}" --admin_password="${WP_PASS}" --admin_email=${WP_EMAIL} --skip-email --title="${WP_SITE_TITLE}"'
else
@echo "Running WordPress multi-site network installation..."
@docker-compose exec -w /app/wordpress/core wordpress-php sh -c 'wp core multisite-install --subdomains --url="${WP_DOMAIN}" --admin_user="${WP_USER}" --admin_password="${WP_PASS}" --admin_email=${WP_EMAIL} --skip-email --title="${WP_SITE_TITLE}"'
endif
@mv wordpress/wp-content/_object-cache.php wordpress/wp-content/object-cache.php
@mv wordpress/wp-content/_advanced-cache.php wordpress/wp-content/advanced-cache.php
@docker-compose down 2>/dev/null
@echo "[DONE] Run 'make up' to start the WordPress services."
# build rebuilds your WordPress PHP image.
build:
@docker-compose build --no-cache
# up launches the WordPress services.
up:
@docker-compose up
# down gracefully shuts it all down.
down:
@docker-compose down
cron:
@crontab -l | grep -q 'http://wordpress.local/wp-cron.php?doing_wp_cron' && echo 'entry exists' || (crontab -l 2>/dev/null; echo "*/5 * * * * curl http://wordpress.local/wp-cron.php?doing_wp_cron >/dev/null 2>&1") | crontab -
@echo Cron task added.
cleancron:
@crontab -l | grep -q 'http://wordpress.local/wp-cron.php?doing_wp_cron' | crontab -
# CAUTION: Use the below targets only if you know what you're doing.
# kill the WordPress database. You will need to run `make init` to get it back.
kill:
@docker-compose run --rm -w /app/wordpress/core wordpress-php wp db drop --yes 2>/dev/null
@docker-compose down 2>/dev/null
# init the WordPress database. This will fail if a database exists.
init:
@docker-compose run --rm -w /app/wordpress/core wordpress-php wp db create 2>/dev/null
@docker-compose down 2>/dev/null
# reset the WordPress database. You will have an empty `wordpress` table.
reset: kill init