-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
149 lines (141 loc) · 5.05 KB
/
Copy pathdocker-compose.yml
File metadata and controls
149 lines (141 loc) · 5.05 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
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
services:
db:
image: mariadb:11
restart: unless-stopped
environment:
MARIADB_ROOT_PASSWORD: ${WP_DB_ROOT_PASSWORD}
MARIADB_DATABASE: ${WP_DB_NAME:-wordpress}
MARIADB_USER: ${WP_DB_USER:-wordpress}
MARIADB_PASSWORD: ${WP_DB_PASSWORD}
volumes:
- db_data:/var/lib/mysql
redis:
image: redis:7-alpine
restart: unless-stopped
volumes:
- redis_data:/data
wordpress:
image: wordpress:beta-7.0-php8.4-apache
restart: unless-stopped
depends_on:
- db
- redis
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_NAME: ${WP_DB_NAME:-wordpress}
WORDPRESS_DB_USER: ${WP_DB_USER:-wordpress}
WORDPRESS_DB_PASSWORD: ${WP_DB_PASSWORD}
WORDPRESS_CONFIG_EXTRA: |
define('FS_METHOD', 'direct');
define('REDIS_QUEUE_HOST', 'redis');
define('REDIS_QUEUE_PORT', 6379);
define('SMTP_HOST', '${SMTP_HOST:-}');
define('SMTP_PORT', '${SMTP_PORT:-465}');
define('SMTP_SECURE', '${SMTP_SECURE:-ssl}');
define('SMTP_USER', '${SMTP_USER:-}');
define('SMTP_PASS', '${SMTP_PASS:-}');
define('SMTP_FROM', '${SMTP_FROM:-webmaster@catholicdigitalcommons.org}');
define('SMTP_FROM_NAME', '${SMTP_FROM_NAME:-Catholic Digital Commons Foundation}');
volumes:
- wordpress_data:/var/www/html
- ./wordpress/themes/cdcf-headless:/var/www/html/wp-content/themes/cdcf-headless
- ./wordpress/plugins/cdcf-redis-translations:/var/www/html/wp-content/plugins/cdcf-redis-translations
wp-init:
image: wordpress:cli
user: "0:0"
depends_on:
- db
- wordpress
- redis
volumes:
- wordpress_data:/var/www/html
- ./wordpress/themes/cdcf-headless:/var/www/html/wp-content/themes/cdcf-headless
- ./wordpress/plugins/cdcf-redis-translations:/var/www/html/wp-content/plugins/cdcf-redis-translations
- ./wordpress/init.sh:/usr/local/bin/init.sh:ro
- ./wordpress/translate-all.php:/usr/local/bin/translate-all.php:ro
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_NAME: ${WP_DB_NAME:-wordpress}
WORDPRESS_DB_USER: ${WP_DB_USER:-wordpress}
WORDPRESS_DB_PASSWORD: ${WP_DB_PASSWORD}
WP_URL: ${WP_URL:-http://localhost}
WP_ADMIN_USER: ${WP_ADMIN_USER:-admin}
WP_ADMIN_PASSWORD: ${WP_ADMIN_PASSWORD:-admin}
WP_ADMIN_EMAIL: ${WP_ADMIN_EMAIL:-admin@cdcf.dev}
OPENAI_API_KEY: ${OPENAI_API_KEY:-}
OPENAI_MODEL: ${OPENAI_MODEL:-gpt-4o-mini}
entrypoint: ["sh", "/usr/local/bin/init.sh"]
restart: "no"
redis-worker:
image: wordpress:cli
user: "0:0"
depends_on:
- db
- wordpress
- redis
volumes:
- wordpress_data:/var/www/html
- ./wordpress/themes/cdcf-headless:/var/www/html/wp-content/themes/cdcf-headless
- ./wordpress/plugins/cdcf-redis-translations:/var/www/html/wp-content/plugins/cdcf-redis-translations
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_NAME: ${WP_DB_NAME:-wordpress}
WORDPRESS_DB_USER: ${WP_DB_USER:-wordpress}
WORDPRESS_DB_PASSWORD: ${WP_DB_PASSWORD}
entrypoint: ["sh", "-c", "echo 'Waiting for database...'; until wp db check --allow-root >/dev/null 2>&1; do sleep 2; done; echo 'Database ready — starting worker loop'; while true; do wp eval 'if(function_exists(\"redis_queue\")){redis_queue()->get_job_processor()->process_jobs([\"default\"], 20);}' --allow-root 2>&1; sleep 10; done"]
restart: unless-stopped
wpcli:
image: wordpress:cli
user: "0:0"
depends_on:
- db
- wordpress
volumes:
- wordpress_data:/var/www/html
- ./wordpress/themes/cdcf-headless:/var/www/html/wp-content/themes/cdcf-headless
- ./wordpress/plugins/cdcf-redis-translations:/var/www/html/wp-content/plugins/cdcf-redis-translations
- ./wordpress/translate-all.php:/usr/local/bin/translate-all.php:ro
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_NAME: ${WP_DB_NAME:-wordpress}
WORDPRESS_DB_USER: ${WP_DB_USER:-wordpress}
WORDPRESS_DB_PASSWORD: ${WP_DB_PASSWORD}
profiles:
- cli
nextjs:
# When Next.js runs inside the compose network it must reach WordPress
# via the docker DNS name `wordpress`, not localhost. The host-side
# values in .env.local (http://localhost:8000/...) would not resolve
# here, so the URLs are hard-coded to the container-perspective ones.
build:
context: .
args:
WP_GRAPHQL_URL: http://wordpress/graphql
image: cdcf-website:latest
restart: unless-stopped
ports:
- "3000:3000"
environment:
- NODE_ENV=production
- WP_GRAPHQL_URL=http://wordpress/graphql
- WP_REST_URL=http://wordpress/wp-json
- WP_PREVIEW_SECRET=${WP_PREVIEW_SECRET}
profiles:
- production
nginx:
image: nginx:alpine
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
- nextjs
- wordpress
profiles:
- production
volumes:
db_data:
redis_data:
wordpress_data: