-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
117 lines (112 loc) · 2.98 KB
/
docker-compose.yml
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
version: "3.3"
services:
db:
image: mysql:5.7
networks:
- back
restart: always
environment:
MYSQL_ROOT_PASSWORD: p4ssw0rd!
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
phpmyadmin:
depends_on:
- db
image: phpmyadmin/phpmyadmin
restart: always
ports:
- 8080:80
environment:
PMA_HOST: db
MYSQL_ROOT_PASSWORD: p4ssw0rd!
networks:
- back
wordpress:
depends_on:
- db
image: wordpress
ports:
- 8000:80
networks:
- front
- back
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_NAME: wordpress
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
WORDPRESS_TABLE_PREFIX: "wp_"
WORDPRESS_DEBUG: 1
volumes:
- wp_data:/var/www/html
- ./build:/var/www/html/wp-content/themes
# node:
# depends_on:
# - db
# - wordpress
# - wordpress-cli
# image: "node:14.12"
# working_dir: /app
# volumes:
# - ./app:/app
# - ./app/node_modules:/app/node_modules
# - ./build:/build
# ports:
# - 3000:3000
# - 3001:3001
# command: >
# /bin/sh -c '
# yarn global add [email protected];
# yarn;
# gulp build;
# '
wordpress-cli:
depends_on:
- db
- wordpress
image: wordpress:cli-1
# run wordpress-cli with the same user-id as wordpress.
# This way there are no permission problems with the cli
user: xfs
# The sleep 60 is required so that the CLI commands are run after
# mysql is initialized. Depending on your machine this might take
# longer or it can go faster.
command: >
/bin/sh -c '
wp option get page_on_front > /dev/null;
if [ $$? -gt 0 ]; then
echo "Waiting for MySQL...";
sleep 60;
fi;
wp core install --path="/var/www/html" --url="http://localhost:8000" --title="Wordpress Timber Docker" --admin_user=admin --admin_password=p4ssw0rd! [email protected];
DATA_EXISTS=$$(wp option get page_on_front);
if [ $$DATA_EXISTS = 0 ];
then
echo "WordPress not setup yet - Setting up title and admin user...";
echo "Removing default data...";
wp plugin delete akismet hello;
wp theme delete twentynineteen twentyseventeen;
wp site empty --yes;
echo "Importing data...";
wp plugin install wordpress-importer --activate;
wp import /var/www/src/theme/data/wordpress-base-data.xml --authors=create;
wp option update show_on_front "page";
wp option update page_on_front 5;
fi;
echo "SUCCESS: WP-CLI setup commands completed.";
tail -F persistCliContainer 2> /dev/null;
'
volumes:
- wp_data:/var/www/html
- ./build:/var/www/html/wp-content/themes
- ./app/src/theme:/var/www/src/theme
networks:
- front
- back
volumes:
wp_data:
networks:
front:
back: