-
Notifications
You must be signed in to change notification settings - Fork 0
/
compose.yaml
executable file
·228 lines (213 loc) · 6.75 KB
/
compose.yaml
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# ------------------------------------------------------------------------------------- #
# DOCKER CONTAINERS https://docs.docker.com/reference/compose-file/services/
# ------------------------------------------------------------------------------------- #
services:
# Status Message (on Successful Launch)
# ----------------------------------------------------------------------- #
# ➜ https://hub.docker.com/_/busybox
# ➜ etc/docker/banner.sh
status:
image: busybox:latest
command: "sh -c 'sleep 1 && /bin/sh /home/banner.sh'"
env_file: &project_env
- ./craftcms/.env
volumes:
- ./etc/docker/banner.sh:/home/banner.sh
depends_on:
nginx:
condition: service_started
frontend:
condition: service_healthy
# PHP FastCGI
# ----------------------------------------------------------------------- #
# ➜ https://github.com/simplicateca/docker-php-fpm
# ➜ etc/docker/php.ini
php: &php_container
image: simplicateca/php-fpm:8.2
command: php-fpm
user: "1000:1000"
restart: on-failure
env_file: *project_env
working_dir: /app
volumes:
- ./craftcms:/app:cached
- ./etc/docker/php.ini:/usr/local/etc/php/conf.d/php.ini
- ./frontend/public:/app/web/dist:cached
depends_on:
composer:
condition: service_completed_successfully
mysql:
condition: service_healthy
redis:
condition: service_started
# Composer (PHP Dependency Management)
# ----------------------------------------------------------------------- #
# ➜ https://hub.docker.com/_/composer
composer:
image: composer:2
command: "composer install --verbose --no-progress --no-interaction"
user: "1000:1000"
volumes:
- ./craftcms:/app
# Craft CMS (with Queue Runner)
# ----------------------------------------------------------------------- #
# ➜ craftcms/composer.json
# ➜ craftcms/.env
craftcms:
<<: *php_container
command: >
bash -c "
./craft install/check --interactive=0 &&
./craft setup/keys --interactive=0 &&
./craft up --interactive=0 &&
./craft clear-caches/all --interactive=0 &&
./craft queue/listen --verbose"
stop_grace_period: "1s"
tty: true
depends_on: [php]
# MySQL 8 Database
# ----------------------------------------------------------------------- #
# ➜ https://hub.docker.com/_/mysql
# ➜ etc/docker/seed
mysql:
image: mysql/mysql-server:8.0
command: --default-authentication-plugin=mysql_native_password
ports:
- 3306:3306
restart: on-failure
env_file: *project_env
environment:
- MYSQL_ROOT_PASSWORD=secret
- MYSQL_DATABASE=${CRAFT_DB_DATABASE:-project}
- MYSQL_USER=${CRAFT_DB_USER:-project}
- MYSQL_PASSWORD=${CRAFT_DB_PASSWORD:-project}
volumes:
- mysql_data:/var/lib/mysql
- ./etc/docker/seed:/docker-entrypoint-initdb.d
healthcheck:
test: "/usr/bin/mysql --user=root --password=$$MYSQL_ROOT_PASSWORD --execute \"SHOW DATABASES;\""
interval: 10s
timeout: 60s
retries: 20
# Node + ViteJS Frontend
# ----------------------------------------------------------------------- #
# ➜ https://hub.docker.com/_/node
# ➜ ./frontend/package.json
frontend:
image: node:lts
command: >
bash -c "
[ ! -f package-lock.json ] && npm install;
[ ! -d node_modules/.vite ] && npm ci;
npm run dev"
restart: on-failure
stop_grace_period: "1s"
tty: true
ports:
- 3000:3000
user: "1000:1000"
working_dir: /var/www/frontend
volumes:
- ./frontend:/var/www/frontend:cached
- ./craftcms/templates:/var/www/craftcms/templates:ro
- ./craftcms/modules:/var/www/craftcms/modules:ro
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/js/app.js"]
interval: 10s
timeout: 120s
retries: 20
# Nginx Webserver
# ----------------------------------------------------------------------- #
# ➜ https://hub.docker.com/_/nginx
# ➜ etc/docker/nginx.conf
nginx:
image: nginx:1-alpine
restart: on-failure
depends_on: [php]
ports:
- 8000:80
volumes:
- ./craftcms/web:/app/web:ro
- ./etc/docker/nginx.conf:/etc/nginx/conf.d/craft.conf:ro
# Redis (Key-Value Storage)
# ----------------------------------------------------------------------- #
# ➜ https://hub.docker.com/_/redis
redis:
image: redis:7-alpine
restart: on-failure
ports:
- 6379:6379
# Mailhog (SMTP Testing Server)
# ----------------------------------------------------------------------- #
# ➜ https://github.com/mailhog/MailHog
mailhog:
image: mailhog/mailhog:latest
restart: on-failure
ports:
- 8025:8025
# Adminer (Database Web UI)
# ----------------------------------------------------------------------- #
# ➜ https://hub.docker.com/_/adminer
# ➜ Requires `debug` profile
adminer:
image: adminer:latest
ports:
- 8080:8080
profiles: [debug]
depends_on: [mysql]
# Minio (s3-Compatible Object Storage)
# ----------------------------------------------------------------------- #
# ➜ https://hub.docker.com/r/minio/minio
minio:
image: minio/minio
command: server /data --console-address ":9001"
env_file: *project_env
environment:
- MINIO_ROOT_USER=${S3_ACCESS_KEY:-project}
- MINIO_ROOT_PASSWORD=${S3_SECRET_KEY:-secretkey}
ports:
- "9000:9000" # S3 API
- "9001:9001" # Web console
volumes:
- minio_data:/data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
# Meilisearch - data storage & search
# ----------------------------------------------------------------------- #
# ➜ https://www.meilisearch.com/
meilisearch:
image: getmeili/meilisearch
env_file: *project_env
environment:
- http_proxy
- https_proxy
- MEILI_MASTER_KEY=secret
- MEILI_NO_ANALYTICS=true
- MEILI_ENV=development
ports:
- 7700:7700
volumes:
- meili_data:/data.ms
# n8n - workflow automation
# ----------------------------------------------------------------------- #
# ➜ https://docs.n8n.io/hosting/installation/server-setups/docker-compose/
n8n:
image: n8nio/n8n
env_file: *project_env
user: "1000:1000"
ports:
- 5678:5678
volumes:
- n8n_data:/home/node/.n8n # App Data
- ./etc/n8n:/home/node/share # File Share
# ------------------------------------------------------------------------------------- #
# CONTAINER DATA STORAGE https://docs.docker.com/reference/compose-file/volumes/
# ------------------------------------------------------------------------------------- #
volumes:
n8n_data:
meili_data:
minio_data:
mysql_data: