-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
84 lines (80 loc) · 2.31 KB
/
docker-compose.yml
File metadata and controls
84 lines (80 loc) · 2.31 KB
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
services:
db:
image: mysql:8.0
volumes:
- db_data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_DATABASE: yourapp
MYSQL_USER: yourapp
MYSQL_PASSWORD: password
restart: "no"
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-prootpassword"]
interval: 5s
timeout: 5s
retries: 20
wordpress:
image: wordpress:latest
ports:
- "8080:80"
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_NAME: yourapp
WORDPRESS_DB_USER: yourapp
WORDPRESS_DB_PASSWORD: password
volumes:
- ./wordpress:/var/www/html
- ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
depends_on:
db:
condition: service_healthy
restart: "no"
healthcheck:
test: ["CMD-SHELL", "[ -f /var/www/html/wp-config.php ]"]
interval: 5s
timeout: 3s
retries: 20
start_period: 10s
# Run Apache as the host user (uid 1000) so files are editable in VSCodium.
# Chown wp-content on each start so any www-data-owned files are corrected.
command:
- bash
- -c
- |
sed -i 's/APACHE_RUN_USER=.*/APACHE_RUN_USER=#1000/' /etc/apache2/envvars &&
sed -i 's/APACHE_RUN_GROUP=.*/APACHE_RUN_GROUP=#1000/' /etc/apache2/envvars &&
chown -R 1000:1000 /var/www/html/wp-content &&
exec apache2-foreground
setup:
image: wordpress:cli
volumes:
- ./wordpress:/var/www/html
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_NAME: yourapp
WORDPRESS_DB_USER: yourapp
WORDPRESS_DB_PASSWORD: password
depends_on:
wordpress:
condition: service_healthy
db:
condition: service_healthy
command: sh -c "wp core is-installed --allow-root 2>/dev/null || wp core install --url='http://localhost:8080' --title='My WordPress Site' --admin_user=admin --admin_password=admin --admin_email=admin@example.com --skip-email --allow-root"
restart: "no"
cli:
image: wordpress:cli
volumes:
- ./wordpress:/var/www/html
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_NAME: yourapp
WORDPRESS_DB_USER: yourapp
WORDPRESS_DB_PASSWORD: password
depends_on:
- db
- wordpress
profiles:
- cli
volumes:
db_data: