@ideasonpurpose/build-tools-wordpress 2.6.6 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,277 @@
1
+ services:
2
+ # Primary database for the local WordPress development environment.
3
+ # Image from: https://hub.docker.com/_/mysql
4
+ db:
5
+ image: &db_img mysql:9.7
6
+ restart: always
7
+ volumes:
8
+ - db_data:/var/lib/mysql
9
+ - ./_db:/docker-entrypoint-initdb.d
10
+ # - ./_log/mysql:/var/log/mysql
11
+ environment:
12
+ MYSQL_ALLOW_EMPTY_PASSWORD: 1
13
+ MYSQL_DATABASE: wordpress
14
+ MYSQL_USER: wordpress
15
+ MYSQL_PASSWORD: wordpress
16
+ # command: >
17
+ # --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
18
+ # Command update from https://x.com/i/grok?conversation=2009819808595165421
19
+ command: >
20
+ --disable-log-bin
21
+ --innodb_flush_log_at_trx_commit=2
22
+ --sync_binlog=0
23
+ --innodb_doublewrite=0
24
+ --slow-query-log=0
25
+ --general-log=0
26
+ --performance_schema=OFF
27
+ logging: # Prevent container logs from bloating on disk
28
+ driver: "json-file"
29
+ options:
30
+ max-size: "10m"
31
+ max-file: "3"
32
+
33
+ # Ideas On Purpose's local WordPress development environment.
34
+ # Update image version with `docker run ideasonpurpose/wordpress init`
35
+ # Project info: https://github.com/ideasonpurpose/docker-wordpress-dev
36
+ wordpress:
37
+ depends_on:
38
+ - db
39
+ # image: &wp_img ideasonpurpose/wordpress:dev
40
+ image: &wp_img ideasonpurpose/wordpress:7.0
41
+ restart: always
42
+ volumes:
43
+ - wp_data:/var/www/html
44
+ - ./wp-content/themes/${npm_package_name:-ioptheme}:/var/www/html/wp-content/themes/${npm_package_name:-ioptheme}
45
+ - ./wp-content/plugins:/var/www/html/wp-content/plugins
46
+ - ./wp-content/uploads:/var/www/html/wp-content/uploads
47
+ - ${IOP_DEV_PLUGIN_1:-/tmp/null:/tmp/IOP_DEV_PLUGIN_1}
48
+ - ${IOP_DEV_PLUGIN_2:-/tmp/null:/tmp/IOP_DEV_PLUGIN_2}
49
+ - ${IOP_DEV_PLUGIN_3:-/tmp/null:/tmp/IOP_DEV_PLUGIN_3}
50
+ - ${IOP_DEV_PLUGIN_4:-/tmp/null:/tmp/IOP_DEV_PLUGIN_4}
51
+ - ${IOP_DEV_PLUGIN_5:-/tmp/null:/tmp/IOP_DEV_PLUGIN_5}
52
+ - ${IOP_DEV_PLUGIN_6:-/tmp/null:/tmp/IOP_DEV_PLUGIN_6}
53
+ - ${IOP_DEV_PLUGIN_7:-/tmp/null:/tmp/IOP_DEV_PLUGIN_7}
54
+ - ${IOP_DEV_PLUGIN_8:-/tmp/null:/tmp/IOP_DEV_PLUGIN_8}
55
+ - ./webpack/xdebug:/tmp/xdebug
56
+
57
+ # Publish port 80 to an ephemeral host port to prepare for future local build tools
58
+ ports:
59
+ - "80"
60
+
61
+ # Internally expose port 9003 for XDebug and profiling
62
+ expose:
63
+ - 9003
64
+
65
+ # Link external plugin projects by defining host:container path pairs in .env
66
+ environment:
67
+ IOP_DEV_PLUGIN_1:
68
+ IOP_DEV_PLUGIN_2:
69
+ IOP_DEV_PLUGIN_3:
70
+ IOP_DEV_PLUGIN_4:
71
+ IOP_DEV_PLUGIN_5:
72
+ IOP_DEV_PLUGIN_6:
73
+ IOP_DEV_PLUGIN_7:
74
+ IOP_DEV_PLUGIN_8:
75
+
76
+ # Required for iptables port-mapping to work inside the Docker image
77
+ # This is used to fix a PHP/WordPress issue where internal requests
78
+ # from Site Health tried to load from external ports.
79
+ cap_add:
80
+ - NET_ADMIN
81
+
82
+ # Utility service for running composer commands
83
+ # Image from: https://hub.docker.com/_/composer
84
+ composer:
85
+ image: composer:2.10
86
+ profiles: ["utility"]
87
+ user: "${UID:-1000}:${GID:-1000}"
88
+ environment:
89
+ COMPOSER_HOME: /.composer
90
+ volumes:
91
+ - ./:/app
92
+ - ~/.composer:/.composer
93
+ command: install
94
+
95
+ # Utility service which exposes wp-cli. Useful for testing pre-releases
96
+ # Update image version with `docker run ideasonpurpose/wordpress init`
97
+ # Project info: https://github.com/ideasonpurpose/docker-wordpress-dev
98
+ wp-cli:
99
+ depends_on:
100
+ - db
101
+ - wordpress
102
+ image: *wp_img
103
+ profiles: ["utility"]
104
+ user: www-data
105
+ volumes:
106
+ - wp_data:/var/www/html
107
+ - ./wp-content/themes/${npm_package_name:-ioptheme}:/var/www/html/wp-content/themes/${npm_package_name:-ioptheme}
108
+ - ./wp-content/plugins:/var/www/html/wp-content/plugins
109
+ - ./wp-content/uploads:/var/www/html/wp-content/uploads
110
+ environment:
111
+ - WP_CLI_CACHE_DIR=/tmp/wp-cli
112
+ - WP_CLI_DISABLE_AUTO_CHECK_UPDATE=true
113
+ command: wp theme activate ${npm_package_name:-ioptheme}
114
+
115
+ # Runs phpMyAdmin on port 8002
116
+ # Image from: https://hub.docker.com/_/phpmyadmin
117
+ phpmyadmin:
118
+ image: phpmyadmin:5.2-apache
119
+ profiles: ["utility"]
120
+ ports:
121
+ - "${npm_config_port:-8002}:80"
122
+ depends_on:
123
+ - db
124
+ environment:
125
+ PMA_USER: root
126
+ PMA_PASSWORD: ~
127
+ UPLOAD_LIMIT: 1G
128
+ command: |
129
+ bash -c 'echo &&
130
+ echo -e "🛠 \033[33mStarting phpMyAdmin at\033[0m \033[36mhttp://localhost:${npm_config_port:-8002}\033[0m" &&
131
+ echo &&
132
+ /docker-entrypoint.sh apache2-foreground'
133
+
134
+ # XDebug profile viewer at http://localhost:9001 (change port with --port=xxxx)
135
+ # Enable profiling by appending `?XDEBUG_PROFILE=1` to any request
136
+ # https://hub.docker.com/r/wodby/webgrind
137
+ webgrind:
138
+ image: wodby/webgrind:1.9
139
+ profiles: ["utility"]
140
+ user: "${UID:-1000}:${GID:-1000}"
141
+ ports:
142
+ - "${npm_config_port:-9004}:8080"
143
+ depends_on:
144
+ - wordpress
145
+ volumes:
146
+ - ./webpack/xdebug:/tmp
147
+ environment:
148
+ WEBGRIND_DEFAULT_TIMEZONE: America/New_York
149
+ command: |
150
+ bash -c 'echo &&
151
+ echo -e "🔍 \033[33mStarting WebGrind server at\033[0m \033[36mhttp://localhost:${npm_config_port:-9004}\033[0m" &&
152
+ echo -e "⏱️ Profile any request by adding \033[1;35m?XDEBUG_PROFILE=1\033[0m to the url" &&
153
+ echo &&
154
+ php -S 0.0.0.0:8080 index.php
155
+ '
156
+
157
+ # Dumps the current database to _db/theme-YYYY-MM-DDTHHMMSS.sql.gz
158
+ db-dump:
159
+ image: *db_img
160
+ profiles: ["utility"]
161
+ depends_on:
162
+ - db
163
+ volumes:
164
+ - ./_db:/usr/src
165
+ environment:
166
+ MYSQL_DATABASE: wordpress
167
+ OWNER_GROUP: "${UID:-1000}:${GID:-1000}"
168
+
169
+ # NOTE: The datbase dumpfile will include these CREATE/USE commands:
170
+ # CREATE DATABASE `wordpress`;
171
+ # USE `wordpress`;
172
+ # to drop those lines, remove "--databases" from the mysqldump command
173
+ command: |
174
+ bash -c 'for i in {1..10}
175
+ do echo -e "⏳ \033[33mWaiting for DB server...\033[0m" &&
176
+ mysql --ssl-mode=DISABLED -s -h db -e "exit" && break || sleep 3
177
+ done &&
178
+ sleep 2 &&
179
+ echo -e "✔️ \033[32mConnected to DB\033[0m" &&
180
+ export DUMPFILE="/usr/src/'${npm_package_name:-dumpfile}'-$$(date +%FT%H%M%S).sql" &&
181
+ echo $${DUMPFILE} &&
182
+ mysqldump --ssl-mode=DISABLED -hdb --databases $${MYSQL_DATABASE} > "$${DUMPFILE}" &&
183
+ gzip "$${DUMPFILE}" &&
184
+ chown -R $${OWNER_GROUP} /usr/src &&
185
+ echo "Successfully dumped database to \"$${DUMPFILE}.gz\""'
186
+
187
+ # Reloads the database from the first found *.sql dumpfile in _db
188
+ db-reload:
189
+ image: *db_img
190
+ profiles: ["utility"]
191
+ depends_on:
192
+ - db
193
+ volumes:
194
+ - ./_db:/usr/src/dumpfiles
195
+ environment:
196
+ MYSQL_DATABASE: wordpress
197
+ command: |
198
+ bash -c 'for i in {1..10}
199
+ do echo -e "⏳ \033[33mWaiting for DB server...\033[0m" &&
200
+ mysql --ssl-mode=DISABLED -s -h db -e "exit" && break || sleep 3
201
+ done &&
202
+ sleep 2 &&
203
+ echo -e "✔️ \033[32mConnected to DB\033[0m" &&
204
+ mysqladmin --ssl-mode=DISABLED -hdb -v -f drop $${MYSQL_DATABASE} &&
205
+ mysqladmin --ssl-mode=DISABLED -hdb -v -f create $${MYSQL_DATABASE} &&
206
+ echo Database \"$${MYSQL_DATABASE}\" created &&
207
+ echo Reloading database from dumpfile &&
208
+ mysql --ssl-mode=DISABLED -hdb $${MYSQL_DATABASE} < $$(ls /usr/src/dumpfiles/*.sql | tail -n1)'
209
+
210
+ # Activates the theme directly in the database
211
+ theme-activate:
212
+ image: *db_img
213
+ profiles: ["utility"]
214
+ depends_on:
215
+ - db
216
+ volumes:
217
+ - ./_db:/usr/src/dumpfiles
218
+ environment:
219
+ MYSQL_DATABASE: wordpress
220
+ command: |
221
+ bash -c 'for i in {1..10}
222
+ do echo -e "⏳ \033[33mWaiting for DB server...\033[0m" &&
223
+ mysql --ssl-mode=DISABLED -s -h db -e "exit" && break || sleep 3
224
+ done &&
225
+ sleep 2 &&
226
+ echo -e "✔️ \033[32mConnected to DB\033[0m" &&
227
+ if [[ $$(mysql --ssl-mode=DISABLED -s -h db $${MYSQL_DATABASE} -e "SHOW TABLES LIKE \"wp_options\"") ]]
228
+ then
229
+ echo -e "🎨 \033[36mActivating theme \033[0m\033[1m${npm_package_name:-ioptheme}\033[0m"
230
+ mysql --ssl-mode=DISABLED -h db $${MYSQL_DATABASE} \
231
+ -e "UPDATE wp_options \
232
+ SET option_value = \"'${npm_package_name:-ioptheme}'\" \
233
+ WHERE option_name in (\"template\",\"stylesheet\")"
234
+ else
235
+ echo -e "Unable to activate theme: \033[31m'\'wp_options\'' table does not exist.\033[0m"
236
+ echo "To recreate an existing site, copy the site'\''s DB dumpfile into _db"
237
+ echo If this project is starting from an empty database, you can ignore this message.
238
+ fi'
239
+
240
+ # Repairs permissions for known project files and directories
241
+ repair-permissions:
242
+ image: *wp_img
243
+ profiles: ["utility"]
244
+ volumes:
245
+ - .:/usr/src/site
246
+ environment:
247
+ OWNER_GROUP: "${UID:-1000}:${GID:-1000}"
248
+ entrypoint: /usr/local/bin/permissions.sh
249
+
250
+ # Locally mirror remote sites by pulling the database, plugins and uploads
251
+ # Remote connections are configured in the project's .env file
252
+ pull:
253
+ image: *wp_img
254
+ profiles: ["utility"]
255
+ volumes:
256
+ - .:/usr/src/site
257
+ entrypoint: |
258
+ /usr/local/bin/pull.sh
259
+ environment:
260
+ OWNER_GROUP: "${UID:-1000}:${GID:-1000}"
261
+ SSH_KEY_PATH:
262
+ SSH_LOGIN:
263
+ SSH_USER:
264
+ SSH_PORT:
265
+ SSH_WP_CONTENT_DIR:
266
+ secrets:
267
+ - SSH_KEY
268
+
269
+ secrets:
270
+ SSH_KEY:
271
+ file: ${SSH_KEY_PATH:-~/.ssh/your_ssh_private_key}
272
+
273
+ volumes:
274
+ db_data:
275
+ name: ${npm_package_name:-ioptheme}_db
276
+ wp_data:
277
+ name: ${npm_package_name:-ioptheme}_wp