forked from Pronovix/docker-drupal-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
178 lines (169 loc) · 8.89 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
###################################################
# THIS IS NOT A PRODUCTION READY CONFIGURATION!!! #
###################################################
version: "3.3"
# TODO Add Traefik configuration.
# If Traefik is not installed it does not do any harm, otherwise it provides a nice addition.
services:
database:
# 10.3 is the default database because Drupal 9 requires MariaDB 10.3.7+.
# https://www.drupal.org/docs/understanding-drupal/how-drupal-9-was-made-and-what-is-included/environment-requirements-of
image: ${DB_IMAGE:-wodby/mariadb:10.3}
container_name: "${COMPOSE_PROJECT_NAME:-my_project}_database"
stop_grace_period: 30s
environment:
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD:-password}
MYSQL_DATABASE: ${DB_NAME:-drupal}
MYSQL_USER: ${DB_USER:-drupal}
MYSQL_PASSWORD: ${DB_PASSWORD:-password}
POSTGRES_PASSWORD: ${DB_PASSWORD:-password}
POSTGRES_DB: ${DB_NAME:-drupal}
POSTGRES_USER: ${DB_USER:-drupal}
volumes:
- database_data:/var/lib/mysql
# - database_data:/var/lib/postgresql/data
php:
# Building a project specific PHP image is beneficial for us, because PhpStorm's PHPCS integration only allows
# to run PHPCS from a Docker image. It does not support to run PHPCS inside a container created by docker-compose.
# See more details about PHPCS configuration in DEVELOPMENT_AND_TESTING.md
build:
context: .
dockerfile: Dockerfile
args:
- PHP_IMAGE=${PHP_IMAGE:-wodby/drupal-php:7.4-dev}
container_name: "${COMPOSE_PROJECT_NAME:-my_project}_php"
working_dir: /mnt/files/local_mount/build
environment:
### DEVELOPMENT ENVIRONMENT ###
COLUMNS: 80
COMPOSER_DISABLE_XDEBUG_WARN: 1
PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025
# (Xdebug can be toggled in CI environments by settings these env vars.)
PHP_XDEBUG: ${PHP_XDEBUG:-1}
PHP_XDEBUG_DEFAULT_ENABLE: ${PHP_XDEBUG_DEFAULT_ENABLE:-1}
PHP_XDEBUG_REMOTE_CONNECT_BACK: 0
PHP_XDEBUG_IDEKEY: PHPSTORM
PHP_XDEBUG_MAX_NESTING_LEVEL: 400
PHP_IDE_CONFIG: serverName=docker
## xDebug 2.x
# This is the default IP of the docker0 interface on Linux.
# More details: https://wodby.com/docs/stacks/drupal/local/#xdebug
# (The default host can be overridden from .bashrc/.zshrc with this environment variable.)
PHP_XDEBUG_REMOTE_HOST: ${PHP_XDEBUG_REMOTE_HOST:-172.17.0.1} # Linux
# PHP_XDEBUG_CLIENT_HOST: host.docker.internal # Docker 18.03+ Mac/Win
# PHP_XDEBUG_CLIENT_HOST: 10.0.75.1 # Windows, Docker < 18.03
## xDebug 3.x
PHP_XDEBUG_CLIENT_HOST: ${PHP_XDEBUG_REMOTE_HOST:-172.17.0.1}
PHP_XDEBUG_MODE: ${PHP_XDEBUG_MODE:-debug}
PHP_XDEBUG_START_WITH_REQUEST: ${PHP_XDEBUG_START_WITH_REQUEST:-yes}
PHP_XDEBUG_PROFILER_OUTPUT_NAME: "cachegrind.out.%R-%t"
# A workaround which suppresses the error logged by xDebug's step debugger when
# there is no debugging client listening. Unfortunatelly this silences xDebug completely.
# If xDebug works unexpectedly this should be removed first because xDebug may tell via log entries
# what is going on.
# Related threads:
# https://stackoverflow.com/questions/65616198
# https://github.com/wodby/php/issues/134
XDEBUG_CONFIG: "log_level=0"
# Share Composer authentication tokens from the host with the container.
# 0 as fallback value works thanks for this implementation:
# https://github.com/composer/composer/blob/79af9d45afb6bcaac8b73ae6a8ae24414ddf8b4b/src/Composer/Factory.php#L204
COMPOSER_AUTH: ${COMPOSER_AUTH:-0}
### TESTING ENVIRONMENT ###
# Run PHP-FPM as the default user (instead of www-data) to eliminate permission issues in testing.
PHP_FPM_USER: wodby
PHP_FPM_GROUP: wodby
DB_HOST: ${DB_HOST:-database}
DB_USER: ${DB_USER:-drupal}
DB_PASSWORD: ${DB_PASSWORD-password}
DB_NAME: ${DB_NAME:-drupal}
DB_DRIVER: ${DB_DRIVER:-mysql}
SIMPLETEST_BASE_URL: http://webserver
SIMPLETEST_DB: ${DB_DRIVER:-mysql}://${DB_USER:-drupal}:${DB_PASSWORD-password}@${DB_HOST:-database}/${DB_NAME:-drupal}
# Suppress deprecation warnings by default.
# https://api.drupal.org/api/drupal/vendor%21symfony%21phpunit-bridge%21DeprecationErrorHandler.php/8.5.x
SYMFONY_DEPRECATIONS_HELPER: ${SYMFONY_DEPRECATIONS_HELPER:-disabled}
MINK_DRIVER_ARGS_WEBDRIVER: '["chrome",{"browserName":"chrome","chromeOptions":{"args":["--disable-gpu","--headless","--no-sandbox","--disable-dev-shm-usage"]}},"http://chrome:9515"]'
# This just sets the tmp folder for generated browser output files. If it is not set then no browser output is
# generated. The actual browser output is always saved to DRUPAL_ROOT . '/sites/simpletest/browser_output'.
# https://www.drupal.org/project/drupal/issues/2992069
BROWSERTEST_OUTPUT_DIRECTORY: "/tmp"
# Default configuration for Behat, Drupal Behat extension and others.
BEHAT_PARAMS: '{"extensions":{"Behat\\MinkExtension":{"base_url":"http://webserver","default_session":"selenium2","browser_name":"chrome","goutte":null,"selenium2":{"wd_host":"http://chrome:9515","browser":"chrome","capabilities":{"chrome":{"switches":["--disable-gpu","--headless","--no-sandbox","--disable-dev-shm-usage"]}}}},"Drupal\\DrupalExtension":{"blackbox":null,"api_driver":"drupal","drupal":{"drupal_root":"%paths.base%/web"},"drush":{"root":"%paths.base%/web"}},"Bex\\Behat\\ScreenshotExtension":{"image_drivers":{"local":{"screenshot_directory":"%paths.base%/behat/screenshots"}}}}}'
### MONOREPO HELPER SETTINGS ###
# Because the build folder contains Drupal core and contrib modules the monorepo helper should not handle
# these packages as monorepo packages.
PRONOVIX_MONOREPO_HELPER_EXCLUDED_DIRECTORIES: 'build'
# Offline mode is enabled by default because usually the Docker container does not have access to GIT remote
# origin. Because of this limitation you have to run `git fetch` regularly on the host.
# You have two options to grants access to the Monorepo Helper to GIT remote origin if it is running inside a
# container:
# * if you use OAuth tokens to authenticate to the remote origin (this works on all host OS-es)
# * if you are on Linux and mount the SSH_AUTH_SOCK to the container.
PRONOVIX_MONOREPO_HELPER_OFFLINE_MODE: 1
### DRUPAL_QA_SETTINGS ###
# Hardcode the location of the webroot because it could not be auto-detected if drupal-qa package is symlinked.
DRUPAL_QA_PHPUNIT_DRUPAL_ROOT: ${WEB_ROOT:-/mnt/files/local_mount/build/web}
# Nightwatch
DRUPAL_TEST_BASE_URL: http://webserver
DRUPAL_TEST_DB_URL: ${DB_DRIVER:-mysql}://${DB_USER:-drupal}:${DB_PASSWORD-password}@${DB_HOST:-database}/${DB_NAME:-drupal}
DRUPAL_TEST_WEBDRIVER_HOSTNAME: chrome
DRUPAL_TEST_WEBDRIVER_PORT: 9515
DRUPAL_TEST_CHROMEDRIVER_AUTOSTART: 'false'
# --no-sandbox is needed, else chrome crashes. See: https://www.drupal.org/project/drupalci_environments/issues/3205271
DRUPAL_TEST_WEBDRIVER_CHROME_ARGS: "--disable-gpu --headless --no-sandbox"
DRUPAL_NIGHTWATCH_OUTPUT: reports/nightwatch
DRUPAL_NIGHTWATCH_IGNORE_DIRECTORIES: node_modules,vendor,.*,sites/*/files,sites/*/private,sites/simpletest
volumes:
- .:/mnt/files/local_mount
webserver:
image: ${WEBSERVER_IMAGE:-wodby/nginx:1.20}
container_name: "${COMPOSE_PROJECT_NAME:-my_project}_webserver"
ports:
- 80
depends_on:
- php
environment:
APACHE_BACKEND_HOST: php
APACHE_SERVER_ROOT: ${WEB_ROOT:-/mnt/files/local_mount/build/web}
NGINX_STATIC_CONTENT_OPEN_FILE_CACHE: "off"
NGINX_BACKEND_HOST: php
NGINX_VHOST_PRESET: drupal9
NGINX_SERVER_ROOT: ${WEB_ROOT:-/mnt/files/local_mount/build/web}
NGINX_STATIC_404_TRY_INDEX: 1
# Make sure that YAML files (eg.: OpenAPI specs) can be served from public files.
# See: https://github.com/wodby/nginx/issues/75
NGINX_DRUPAL_FILES_STATIC_EXT_REGEX: txt|yaml|yml
volumes:
- .:/mnt/files/local_mount
chrome:
image: drupalci/webdriver-chromedriver:production
container_name: "${COMPOSE_PROJECT_NAME:-my_project}_chrome"
depends_on:
- webserver
ulimits:
core:
soft: -1
hard: -1
entrypoint:
- chromedriver
- "--log-path=/tmp/chromedriver.log"
- "--verbose"
- "--whitelisted-ips="
- "--allowed-origins=*"
mailhog:
image: mailhog/mailhog
container_name: "${COMPOSE_PROJECT_NAME:-my_project}_mailhog"
ports:
- 8025
node:
image: ${NODE_IMAGE:-wodby/node:14}
container_name: "${COMPOSE_PROJECT_NAME:-my_project}_node"
command: "tail -f /dev/null"
# Should point to a directory with package.json.
working_dir: /mnt/files/local_mount
volumes:
- .:/mnt/files/local_mount
volumes:
# Persistent database storage.
database_data: