-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
244 lines (227 loc) · 9.81 KB
/
docker-compose.yml
File metadata and controls
244 lines (227 loc) · 9.81 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
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
# 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.
# See more about Docker at https://www.vortextemplate.com/docs/docker/
# For YAML support of anchors and references, see http://blog.daemonl.com/2016/02/yaml.html
# ------------------------------------------------------------------------------
# Variable aliases.
# ------------------------------------------------------------------------------
# Environment variables set in all containers during build and runtime.
# Note that these variables are not read from here in Lagoon environment.
x-environment: &default-environment
TZ: ${TZ:-UTC}
# Pass-through 'CI' variable used to identify the CI environment.
CI: ${CI:-}
# Pass-through 'XDEBUG_ENABLE' to enable XDebug with "ahoy debug" or "XDEBUG_ENABLE=true docker compose up -d".
XDEBUG_ENABLE: ${XDEBUG_ENABLE:-}
# 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 (variable is not used in hosting environment).
DATABASE_HOST: database
# Local database name (variable is not used in hosting environment).
DATABASE_NAME: drupal
# Local database user (variable is not used in hosting environment).
DATABASE_USERNAME: drupal
# Local database password (variable is not used in hosting environment).
DATABASE_PASSWORD: drupal
# Local database port (variable is not used in hosting environment).
DATABASE_PORT: 3306
# Local database charset (variable is not used in hosting environment).
DATABASE_CHARSET: utf8mb4
# Local database collation (variable is not used in hosting environment).
DATABASE_COLLATION: utf8mb4_general_ci
# Trusted host patterns.
DRUPAL_TRUSTED_HOSTS: ${DRUPAL_TRUSTED_HOSTS:-}
# Drupal theme name.
DRUPAL_THEME: ${DRUPAL_THEME:-olivero}
# Drupal file paths.
DRUPAL_PUBLIC_FILES: ${DRUPAL_PUBLIC_FILES:-sites/default/files}
DRUPAL_PRIVATE_FILES: ${DRUPAL_PRIVATE_FILES:-sites/default/files/private}
DRUPAL_TEMPORARY_FILES: ${DRUPAL_TEMPORARY_FILES:-/tmp}
# Path to configuration files.
DRUPAL_CONFIG_PATH: ${DRUPAL_CONFIG_PATH:-../config/default}
# Drupal Shield credentials.
DRUPAL_SHIELD_USER: ${DRUPAL_SHIELD_USER:-}
DRUPAL_SHIELD_PASS: ${DRUPAL_SHIELD_PASS:-}
# Redis integration flag.
DRUPAL_REDIS_ENABLED: ${DRUPAL_REDIS_ENABLED:-}
# 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'
# Volumes available in each container to share application data.
# See more about Docker host volume mounting at https://www.vortextemplate.com/docs/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.
# ------------------------------------------------------------------------------
# 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: "${WEBROOT:-web}"
PACKAGE_TOKEN: "${PACKAGE_TOKEN:-}"
DRUPAL_PUBLIC_FILES: ${DRUPAL_PUBLIC_FILES:-sites/default/files}
DRUPAL_PRIVATE_FILES: ${DRUPAL_PRIVATE_FILES:-sites/default/files/private}
DRUPAL_TEMPORARY_FILES: ${DRUPAL_TEMPORARY_FILES:-/tmp}
DRUPAL_THEME: ${DRUPAL_THEME:-}
VORTEX_FRONTEND_BUILD_SKIP: ${VORTEX_FRONTEND_BUILD_SKIP:-}
secrets:
- package_token
image: &cli-image ${COMPOSE_PROJECT_NAME:-example_site}
environment:
<<: *default-environment
<<: *default-volumes
# 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.
depends_on:
wait-for-dependencies:
condition: service_completed_successfully
user: root
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.
nginx:
build:
context: .
dockerfile: .docker/nginx-drupal.dockerfile
args:
CLI_IMAGE: *cli-image
WEBROOT: "${WEBROOT:-web}"
additional_contexts:
cli: "service:cli"
environment:
<<: *default-environment
<<: [ *default-volumes, *default-user ]
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.
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
# PHP FPM container. All web requests are going through this container.
php:
build:
context: .
dockerfile: .docker/php.dockerfile
args:
CLI_IMAGE: *cli-image
additional_contexts:
cli: "service:cli"
environment:
<<: *default-environment
<<: [ *default-volumes, *default-user ]
depends_on:
- cli
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
database:
build:
context: .
dockerfile: .docker/database.dockerfile
args:
IMAGE: "${VORTEX_DB_IMAGE:-uselagoon/mysql-8.4:26.2.0}" # Use custom database image (if defined) or fallback to standard database image.
environment:
<<: *default-environment
<<: *default-user
ports:
- '3306' # Database port in a container. Find port on host with `ahoy info` or `docker compose port database 3306`.
labels:
lagoon.type: mariadb # See https://docs.lagoon.sh/using-lagoon-advanced/service-types/
redis:
image: uselagoon/valkey-8:26.2.0
labels:
lagoon.type: redis # Change to 'none' if dedicated Redis service is used. See https://docs.lagoon.sh/using-lagoon-advanced/service-types/
solr:
build:
context: .
dockerfile: .docker/solr.dockerfile
environment:
<<: *default-environment
volumes:
- solr:/var/solr
ports:
- '8983' # Solr port in a container. Find port on host with `ahoy info` or `docker compose port solr 8983`.
labels:
lagoon.type: solr # See https://docs.lagoon.sh/using-lagoon-advanced/service-types/
clamav:
build:
context: .
dockerfile: .docker/clamav.dockerfile
environment:
<<: *default-environment
ports:
- '3310' # Find port on host with `docker compose port clamav 3310`.
networks:
- default
labels:
lagoon.type: basic
lagoon.service.port: 3310 # See https://docs.lagoon.sh/using-lagoon-advanced/service-types/
lagoon.autogeneratedroute: false
# Chrome container, used for browser testing.
chrome:
image: selenium/standalone-chromium:145.0
environment:
<<: *default-environment
<<: *default-volumes
depends_on:
- cli
ports:
- '7900' # Find port on host with `docker compose port chrome 7900`.
shm_size: '1gb' # Increase '/dev/shm' partition size to avoid browser crashing.
labels:
lagoon.type: none # Do not deploy in Lagoon.
# Helper container to wait for services to become available.
wait-for-dependencies:
image: drevops/docker-wait-for-dependencies:26.1.0
depends_on:
- clamav
- database
- redis
- solr
command:
- clamav:3310
- database:3306
- redis:6379
- solr:8983
- curl -s "http://solr:8983/solr/drupal/select?q=*:*&rows=0&wt=json" | grep response
labels:
lagoon.type: none # Do not deploy in 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: {}
secrets:
package_token:
environment: PACKAGE_TOKEN