-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
docker-compose.yml
257 lines (240 loc) Β· 9.74 KB
/
docker-compose.yml
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# Docker Compose configuration file.
#
# - Using a single file to work in local, CI and production environments.
# - Local overrides are possible using docker-compose.override.yml file.
# - Environment variables are read from .env file.
# - Containers will be named after the project directory.
# - Use inline comments containing '###' to have the line removed in CI.
# - Use inline comments starting with '##' to have the line being automatically
# uncommented in CI.
#; - Comments starting with '#;', '#;<' or '#;>' (like the ones used for the
#; current paragraph) are explaining Vortex inner workings and can be
#; safely removed for your project. They are automatically removed when
#; installing or updating Vortex.
#;
# See more about Docker at https://vortex.drevops.com/docker/
# For YAML support of anchors and references, see http://blog.daemonl.com/2016/02/yaml.html
# ------------------------------------------------------------------------------
# Variable aliases.
# ------------------------------------------------------------------------------
# Volumes available in each container to share application data.
# See more about Docker host volume mounting at https://vortex.drevops.com/docker#host-volume-mounting-in-docker-based-projects
x-volumes: &default-volumes
volumes:
# All application files mounted into container.
- .:/app:${VOLUME_FLAGS:-delegated} ### Local overrides to mount host filesystem. Automatically removed in CI and PROD.
# Override mount for files to allow different type of syncing for optimised performance.
- ./web/sites/default/files:/app/web/sites/default/files:${VOLUME_FLAGS:-delegated} ### Local overrides to mount host filesystem. Automatically removed in CI and PROD.
# Use the same volumes in environments without host mounts support.
##- app:/app # Override for environment without host mounts. Automatically uncommented in CI.
##- files:/app/web/sites/default/files # Override for environment without host mounts. Automatically uncommented in CI.
# The default user under which the containers should run.
x-user: &default-user
# Change this if you are on linux and run with another user than id `1000`
user: '1000'
# Environment variables set in all containers during build and runtime.
#;< LAGOON
# Note that these variables are not read from here in Lagoon environment.
#;> LAGOON
x-environment: &default-environment
TZ: ${VORTEX_TZ:-Australia/Melbourne}
# Local development URL.
VORTEX_LOCALDEV_URL: &default-url ${COMPOSE_PROJECT_NAME:-example-site}.docker.amazee.io
# Local development route used in Lagoon images and Pygmy to route requests.
LAGOON_ROUTE: *default-url
# Local database host (not used in production).
DATABASE_HOST: database
# Local database name (not used in production).
DATABASE_NAME: drupal
# Local database user (not used in production).
DATABASE_USERNAME: drupal
# Local database password (not used in production).
DATABASE_PASSWORD: drupal
# Local database port (not used in production).
DATABASE_PORT: 3306
# Pass-through 'XDEBUG_ENABLE' to enable XDebug with "ahoy debug" or "XDEBUG_ENABLE=true docker compose up -d".
XDEBUG_ENABLE: ${XDEBUG_ENABLE:-}
# Pass-through 'CI' variable used to identify the CI environment.
CI: ${CI:-}
# Path to configuration files.
DRUPAL_CONFIG_PATH: ${DRUPAL_CONFIG_PATH:-/app/config/default}
# Drupal file paths.
DRUPAL_PUBLIC_FILES: ${DRUPAL_PUBLIC_FILES:-/app/web/sites/default/files}
DRUPAL_PRIVATE_FILES: ${DRUPAL_PRIVATE_FILES:-/app/web/sites/default/files/private}
DRUPAL_TEMPORARY_FILES: ${DRUPAL_TEMPORARY_FILES:-/tmp}
# Drupal Shield credentials.
DRUPAL_SHIELD_USER: ${DRUPAL_SHIELD_USER:-}
DRUPAL_SHIELD_PASS: ${DRUPAL_SHIELD_PASS:-}
#;< REDIS
# Redis integration flag.
DRUPAL_REDIS_ENABLED: ${DRUPAL_REDIS_ENABLED:-}
#;> REDIS
# ------------------------------------------------------------------------------
# Services.
# ------------------------------------------------------------------------------
services:
# CLI container, used for executing CLI commands such as Composer, Drush etc. Not used to handle web requests.
cli:
build:
context: .
dockerfile: .docker/cli.dockerfile
args:
WEBROOT: "${VORTEX_WEBROOT:-web}"
GITHUB_TOKEN: "${GITHUB_TOKEN:-}"
image: &cli-image ${COMPOSE_PROJECT_NAME:-example_site}
user: root
<<: *default-volumes
environment:
<<: *default-environment
# Mount volumes from the ssh-agent running in Pygmy to inject host SSH key into container. See https://pygmy.readthedocs.io/en/master/ssh_agent/
volumes_from: ### Local overrides to mount host SSH keys. Automatically removed in CI.
- container:amazeeio-ssh-agent ### Local overrides to mount host SSH keys. Automatically removed in CI.
#;< LAGOON
labels:
lagoon.type: cli-persistent # See https://docs.lagoon.sh/using-lagoon-advanced/service-types/
lagoon.persistent.name: &lagoon-nginx-name nginx-php # Mount the persistent storage of nginx-php pod into this container.
lagoon.persistent: &lagoon-persistent-files /app/web/sites/default/files/ # Location where the persistent storage should be mounted.
#;> LAGOON
nginx:
build:
context: .
dockerfile: .docker/nginx-drupal.dockerfile
args:
CLI_IMAGE: *cli-image
WEBROOT: "${VORTEX_WEBROOT:-web}"
DRUPAL_CONFIG_PATH: ${DRUPAL_CONFIG_PATH:-/app/config/default}
DRUPAL_PUBLIC_FILES: ${DRUPAL_PUBLIC_FILES:-/app/web/sites/default/files}
DRUPAL_PRIVATE_FILES: ${DRUPAL_PRIVATE_FILES:-/app/web/sites/default/files/private}
DRUPAL_TEMPORARY_FILES: ${DRUPAL_TEMPORARY_FILES:-/tmp}
<<: [*default-volumes, *default-user]
environment:
<<: *default-environment
depends_on:
- cli
networks:
- default # This is a standard network and is used for all other environments, where requests routing is not required and/or not supported.
- amazeeio-network ### This network is supported by Pygmy and used to route all requests to host machine locally. Removed in CI.
#;< LAGOON
labels:
lagoon.type: nginx-php-persistent # See https://docs.lagoon.sh/using-lagoon-advanced/service-types/
lagoon.name: *lagoon-nginx-name
lagoon.persistent: *lagoon-persistent-files
lagoon.persistent.class: slow
#;> LAGOON
# PHP FPM container. All web requests are going through this container.
php:
build:
context: .
dockerfile: .docker/php.dockerfile
args:
CLI_IMAGE: *cli-image
<<: [*default-volumes, *default-user]
environment:
<<: *default-environment
depends_on:
- cli
#;< LAGOON
labels:
lagoon.type: nginx-php-persistent # See https://docs.lagoon.sh/using-lagoon-advanced/service-types/
lagoon.name: *lagoon-nginx-name
lagoon.persistent: *lagoon-persistent-files
lagoon.persistent.class: slow
#;> LAGOON
database:
build:
context: .
dockerfile: .docker/database.dockerfile
args:
IMAGE: "${VORTEX_DB_IMAGE:-uselagoon/mariadb-10.11-drupal:24.12.0}" # Use custom database image (if defined) or fallback to standard database image.
<<: *default-user
environment:
<<: *default-environment
ports:
- "3306" # MariaDB port in container. Find port on host with `ahoy info` or `docker compose port database 3306`.
#;< LAGOON
labels:
lagoon.type: mariadb # See https://docs.lagoon.sh/using-lagoon-advanced/service-types/
#;> LAGOON
#;< REDIS
redis:
image: uselagoon/redis-6:24.12.0
#;< LAGOON
labels:
lagoon.type: redis # Change to 'none' if dedicated Redis service is used. See https://docs.lagoon.sh/using-lagoon-advanced/service-types/
#;> LAGOON
#;> REDIS
#;< SOLR
solr:
build:
context: .
dockerfile: .docker/solr.dockerfile
args:
CLI_IMAGE: *cli-image
environment:
<<: *default-environment
depends_on:
- cli
ports:
- "8983" # Solr port in container. Find port on host with `ahoy info` or `docker compose port solr 8983`.
volumes:
- solr:/var/solr
#;< LAGOON
labels:
lagoon.type: solr # See https://docs.lagoon.sh/using-lagoon-advanced/service-types/
#;> LAGOON
#;> SOLR
#;< CLAMAV
clamav:
build:
context: .
dockerfile: .docker/clamav.dockerfile
platform: linux/amd64
ports:
- "3310" # Find port on host with `docker compose port clamav 3310`.
environment:
<< : *default-environment
networks:
- default
#;< LAGOON
labels:
lagoon.type: basic
lagoon.service.port: 3310 # See https://docs.lagoon.sh/using-lagoon-advanced/service-types/
lagoon.autogeneratedroute: false
#;> LAGOON
#;> CLAMAV
# Chrome container, used for browser testing.
chrome:
image: selenium/standalone-chromium:131.0
ports:
- "7900" # Find port on host with `docker compose port chrome 7900`.
shm_size: '1gb' # Increase '/dev/shm' partition size to avoid browser crashing.
<<: *default-volumes # Use default volumes to provide access to test fixtures.
environment:
<<: *default-environment
depends_on:
- cli
#;< LAGOON
labels:
lagoon.type: none # Do not deploy in Lagoon.
#;> LAGOON
# Helper container to wait for services to become available.
wait_dependencies:
image: drevops/docker-wait-for-dependencies:24.12.0
depends_on:
- cli
- database
- clamav
command: database:3306 clamav:3310
#;< LAGOON
labels:
lagoon.type: none # Do not deploy in Lagoon.
#;> LAGOON
networks: ### Use external networks locally. Automatically removed in CI.
amazeeio-network: ### Automatically removed in CI.
external: true ### Automatically removed in CI.
volumes:
app: {}
files: {}
#;< SOLR
solr: {}
#;> SOLR