-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
89 lines (85 loc) · 2.67 KB
/
docker-compose.yml
File metadata and controls
89 lines (85 loc) · 2.67 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
85
86
87
88
89
services:
db:
image: mariadb:lts
volumes:
- db_data:/var/lib/mysql
environment:
MARIADB_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
MARIADB_DATABASE: ${DB_NAME}
MARIADB_USER: ${DB_USER}
MARIADB_PASSWORD: ${DB_PASSWORD}
restart: "no"
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 5s
timeout: 5s
retries: 20
wordpress:
image: wordpress:latest
ports:
- "${WP_PORT}:80"
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_NAME: ${DB_NAME}
WORDPRESS_DB_USER: ${DB_USER}
WORDPRESS_DB_PASSWORD: ${DB_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.
# Inject a chown into the image entrypoint so wp-content gets fixed AFTER
# the entrypoint copies WordPress files in on first start.
entrypoint:
- 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
if ! grep -q 'chown -R 1000:1000' /usr/local/bin/docker-entrypoint.sh; then
sed -i 's|^exec "$@"|chown -R 1000:1000 /var/www/html/wp-content\nexec "$@"|' /usr/local/bin/docker-entrypoint.sh
fi
exec /usr/local/bin/docker-entrypoint.sh "$@"
- --
command: ["apache2-foreground"]
setup:
image: wordpress:cli
volumes:
- ./wordpress:/var/www/html
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_NAME: ${DB_NAME}
WORDPRESS_DB_USER: ${DB_USER}
WORDPRESS_DB_PASSWORD: ${DB_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:${WP_PORT}' --title='${SITE_TITLE}' --admin_user='${ADMIN_USER}' --admin_password='${ADMIN_PASSWORD}' --admin_email='${ADMIN_EMAIL}' --skip-email --allow-root"
restart: "no"
cli:
image: wordpress:cli
volumes:
- ./wordpress:/var/www/html
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_NAME: ${DB_NAME}
WORDPRESS_DB_USER: ${DB_USER}
WORDPRESS_DB_PASSWORD: ${DB_PASSWORD}
depends_on:
- db
- wordpress
profiles:
- cli
volumes:
db_data: