forked from civictheme/monorepo-drupal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
166 lines (152 loc) · 6.99 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
# Docker Compose configuration file.
#
# - Using a single file to work in local, CI and production environments.
# - Local overrides are possible using docker-composer.override.yml file.
# - Environment variables are read from .env file.
# - 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/
version: '2.3'
# ------------------------------------------------------------------------------
# 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.
- ./docroot/sites/default/files:/app/docroot/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/docroot/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
# Project name. Defaults to Docker Compose project name (which defaults to the current directory).
DREVOPS_PROJECT: ${DREVOPS_PROJECT:-example_site}
# Local development URL used in Lagoon images.
LAGOON_LOCALDEV_URL: &default-url ${DREVOPS_LOCALDEV_URL:-example-site.docker.amazee.io}
# Local route used in Lagoon images and Pygmy to route requests.
LAGOON_ROUTE: *default-url
# 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:-}
# Uncomment below if emails are not being received by 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:-}
# Global project name for Lagoon.
LAGOON_PROJECT: ${LAGOON_PROJECT:-example_site}
# Lagoon environment type.
LAGOON_ENVIRONMENT_TYPE: ${LAGOON_ENVIRONMENT_TYPE:-local}
GITHUB_TOKEN: ${GITHUB_TOKEN:-}
COMPOSER: ${COMPOSER:-}
# ------------------------------------------------------------------------------
# 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/Dockerfile.cli
args:
GITHUB_TOKEN: "${GITHUB_TOKEN:-}"
COMPOSER: "${COMPOSER:-}"
image: &cli-image ${DREVOPS_PROJECT:-example_site}-cli
<<: *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-drupal-files /app/docroot/sites/default/files/ # Location where the persistent storage should be mounted.
nginx:
build:
context: .
dockerfile: .docker/Dockerfile.nginx-drupal
args:
CLI_IMAGE: *cli-image
<<: [*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-drupal-files
lagoon.persistent.class: slow
# PHP FPM container. All web requests are going through this container.
php:
build:
context: .
dockerfile: .docker/Dockerfile.php
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-drupal-files
lagoon.persistent.class: slow
mariadb:
build:
context: .
dockerfile: .docker/Dockerfile.mariadb
args:
IMAGE: "${DREVOPS_DB_DOCKER_IMAGE:-uselagoon/mariadb-drupal:23.3.0}" # Use custom database image (if defined) or fallback to standard database image.
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: dadarek/wait-for-dependencies
depends_on:
- cli
- mariadb
command: mariadb:3306
labels:
lagoon.type: none # Do not deploy in Lagoon.
networks:
amazeeio-network:
external: true
volumes:
app: {}
files: {}