-
Notifications
You must be signed in to change notification settings - Fork 16
/
docker-compose.yml
173 lines (160 loc) · 7.32 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
# 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 DrevOps Docker at https://docs.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://docs.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 to optimise 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.
# Note that these variables are not read from here in Lagoon environment.
x-environment: &default-environment
TZ: ${DREVOPS_TZ:-Australia/Melbourne}
# Local development URL.
DREVOPS_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).
MARIADB_HOST: mariadb
# Local database name (not used in production).
MARIADB_DATABASE: drupal
# Local database user (not used in production).
MARIADB_USERNAME: drupal
# Local database password (not used in production).
MARIADB_PASSWORD: drupal
# Local database port (not used in production).
MARIADB_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:-}
# Forward emails to Mailhog locally.
SSMTP_MAILHUB: ${SSMTP_MAILHUB:-host.docker.internal:1025}
# Drupal Shield credentials.
DRUPAL_SHIELD_USER: ${DRUPAL_SHIELD_USER:-}
DRUPAL_SHIELD_PASS: ${DRUPAL_SHIELD_PASS:-}
# Lagoon environment type.
LAGOON_ENVIRONMENT_TYPE: ${LAGOON_ENVIRONMENT_TYPE:-local}
# ------------------------------------------------------------------------------
# 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: "${DREVOPS_WEBROOT:-web}"
GITHUB_TOKEN: "${GITHUB_TOKEN:-}"
image: &cli-image ${COMPOSE_PROJECT_NAME:-example_site}
<<: *default-volumes
user: root
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.
ports:
- "35729" # Livereload port in container. Find port on host with `ahoy info` or `docker compose port cli 35729`.
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: "${DREVOPS_WEBROOT:-web}"
<<: [*default-volumes, *default-user]
environment:
<<: *default-environment
depends_on:
- cli
networks:
- amazeeio-network # This network is supported by Pygmy and used to route all requests to host machine.
- default # This is a standard network and is used for all other environments, where requests routing is not required and/or not supported.
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
<<: [*default-volumes, *default-user]
environment:
<<: *default-environment
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
mariadb:
build:
context: .
dockerfile: .docker/mariadb.dockerfile
args:
IMAGE: "${DREVOPS_DB_DOCKER_IMAGE:-uselagoon/mariadb-10.11-drupal:24.5.1}" # 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 mariadb 3306`.
labels:
lagoon.type: mariadb # See https://docs.lagoon.sh/using-lagoon-advanced/service-types/
# Chrome container, used for browser testing.
chrome:
image: selenium/standalone-chrome:111.0
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
labels:
lagoon.type: none # Do not deploy in Lagoon.
# Helper container to wait for services to become available.
wait_dependencies:
image: drevops/docker-wait-for-dependencies:24.3.0
depends_on:
- cli
- mariadb
command: mariadb:3306
labels:
lagoon.type: none # Do not deploy in Lagoon.
networks:
amazeeio-network:
external: true
volumes:
app: {}
files: {}