-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
206 lines (187 loc) · 7.4 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
version: '2.3'
x-lagoon-project:
# Lagoon project name (leave `&lagoon-project` when you edit this).
# Note that we need to provide env default values for execution on lagoon.
&lagoon-project ${COMPOSE_PROJECT_NAME:-{{ project }}}
x-labels:
&default-labels
# Define labels added to all containers.
lupus-ci.job_name: ${LUPUS_CI_JOB_NAME:-}
x-container:
&container-defaults
restart: ${COMPOSER_CONTAINER_RESTART:-always}
x-volumes:
&default-volumes
# Define all volumes you would like to have real-time mounted into the docker containers
volumes:
- ${COMPOSE_CACHE_DIR:-./devsetup-docker/data}/.composer/cache:/home/.composer/cache
- ${COMPOSE_CACHE_DIR:-./devsetup-docker/data}/.npm:/home/.npm
- ${COMPOSE_APP_DIR:-.}:/app:delegated
x-networks:
&add-traefik
default: {}
traefik: {}
x-environment:
&default-environment
LAGOON_PROJECT: *lagoon-project
# Route that should be used locally, if you are using pygmy,
# this route *must* end with .docker.amazee.io
LAGOON_ROUTE: http://${COMPOSE_HOSTNAME}
# Uncomment if you like to have the system behave like in production
#LAGOON_ENVIRONMENT_TYPE: production
MARIADB_DATABASE: ${PHAPP_ENV_MYSQL_DEFAULT_DATABASE:-drupal}
MARIADB_USER: ${PHAPP_ENV_MYSQL_DEFAULT_USERNAME:-drupal}
MARIADB_PASSWORD: ${PHAPP_ENV_MYSQL_DEFAULT_PASSWORD:-change-me}
MARIADB_ROOT_PASSWORD: ${PHAPP_ENV_MYSQL_DEFAULT_PASSWORD:-Lag00n-change-me}
# Pass through some lupus-ci env variables; e.g. the now token for automated deployment.
NOW_TOKEN: ${NOW_TOKEN:-}
GIT_BRANCH: ${GIT_BRANCH:-}
# Comment to disable Redis cache and cache failover
ENABLE_REDIS: "true"
x-user:
&default-user
# The default user under which the containers should run.
# Change this if you are on linux and run with another user than id `1000`
user: ${COMPOSE_DEFAULT_USER:-1000}
services:
# cli container, will be used for executing composer and any local commands
# (drush, drupal, etc.)
# This image will be reused as `CLI_IMAGE` in subsequent Docker builds.
cli:
build:
context: .
dockerfile: devsetup-docker/Dockerfile.cli
args:
APP_FILES: ${COMPOSE_BUILD_APP_FILES:-.}
LAGOON_SSH_PRIVATE_KEY: ${LAGOON_SSH_PRIVATE_KEY:-}
COMPOSE_DEFAULT_USER: ${COMPOSE_DEFAULT_USER:-1000}
COMPOSE_AMAZEEIO_PHP_VERSION: ${COMPOSE_AMAZEEIO_PHP_VERSION:-8.1}
COMPOSE_AMAZEEIO_VERSION: ${COMPOSE_AMAZEEIO_VERSION:-latest}
image: *lagoon-project
labels:
# Lagoon Labels
lagoon.type: cli-persistent
lagoon.persistent.name: nginx # mount the persistent storage of nginx into this container
lagoon.persistent: /app/files/ # location where the persistent storage should be mounted
<< : *default-labels
<< : [*default-volumes, *default-user, *container-defaults] # uses the defined user and volumes from top
environment:
<< : *default-environment # loads the defined environment variables from the top
networks:
<< : *add-traefik
nginx:
build:
context: devsetup-docker
dockerfile: Dockerfile.nginx
args:
COMPOSE_AMAZEEIO_VERSION: ${COMPOSE_AMAZEEIO_VERSION:-latest}
CLI_IMAGE: *lagoon-project # Inject the name of the cli image
labels:
lagoon.type: nginx-php-persistent
lagoon.persistent: /app/files/ # define where the persistent storage should be mounted too
traefik.enable: true
traefik.port: 8080
traefik.frontend.rule: "HostRegexp:nginx.{subdomain:([0-9A-Za-z_-]+.)?}${COMPOSE_HOSTNAME}"
traefik.frontend.auth.basic.users: ${COMPOSE_DEFAULT_AUTH:-}
<< : *default-labels
<< : [*default-volumes, *default-user, *container-defaults] # uses the defined user and volumes from top
depends_on:
- cli # basically just tells docker-compose to build the cli first
environment:
<< : *default-environment # loads the defined environment variables from the top
LAGOON_LOCALDEV_URL: ${COMPOSE_HOSTNAME} # generate another route for nginx, by default we go to varnish
networks:
<< : *add-traefik
php:
build:
context: devsetup-docker
dockerfile: Dockerfile.php
args:
COMPOSE_AMAZEEIO_PHP_VERSION: ${COMPOSE_AMAZEEIO_PHP_VERSION:-8.1}
COMPOSE_AMAZEEIO_VERSION: ${COMPOSE_AMAZEEIO_VERSION:-latest}
CLI_IMAGE: *lagoon-project
labels:
lagoon.type: nginx-php-persistent
lagoon.name: nginx # we want this service be part of the nginx pod in Lagoon
lagoon.persistent: /app/files/ # define where the persistent storage should be mounted too
<< : *default-labels
<< : [*default-volumes, *default-user, *container-defaults] # uses the defined user and volumes from top
depends_on:
- cli # basically just tells docker-compose to build the cli first
environment:
<< : *default-environment # loads the defined environment variables from the top
mariadb:
build:
context: devsetup-docker
dockerfile: Dockerfile.mariadb
args:
COMPOSE_AMAZEEIO_VERSION: ${COMPOSE_AMAZEEIO_VERSION:-latest}
labels:
lagoon.type: mariadb
<< : *default-labels
<< : [*default-user, *container-defaults] # uses the defined user from top
environment:
<< : *default-environment
volumes:
- data-volume:/var/lib/mysql
redis:
build:
context: devsetup-docker
dockerfile: Dockerfile.redis
args:
COMPOSE_AMAZEEIO_VERSION: ${COMPOSE_AMAZEEIO_VERSION:-latest}
labels:
lagoon.type: redis
<< : *default-labels
<< : [*default-user, *container-defaults] # uses the defined user from top
environment:
<< : *default-environment
## Enable, if memcached should be used instead of redis (above).
# memcached:
# image: memcached:${MEMCACHED_VERSION:-1.5.2}
# command: ["-m", "${MEMCACHED_MEMORY:-32M}"]
# << : *container-defaults
# labels:
# << : *default-labels
solr:
build:
context: devsetup-docker
dockerfile: Dockerfile.solr
args:
COMPOSE_AMAZEEIO_VERSION: ${COMPOSE_AMAZEEIO_VERSION:-latest}
labels:
lagoon.type: solr
<< : *default-labels
<< : *container-defaults
environment:
<< : *default-environment
varnish:
build:
context: devsetup-docker
dockerfile: Dockerfile.varnish
args:
COMPOSE_AMAZEEIO_VERSION: ${COMPOSE_AMAZEEIO_VERSION:-latest}
labels:
lagoon.type: varnish
traefik.enable: true
## Restrict access for GET and POST request but allow CORS OPTIONS request without password.
traefik.servicemain.frontend.rule: "Method:GET,POST,HEAD,PUT,PATCH,DELETE;HostRegexp:{subdomain:([0-9A-Za-z_-]+.)?}${COMPOSE_HOSTNAME}"
traefik.servicemain.frontend.auth.basic.users: ${COMPOSE_DEFAULT_AUTH:-}
traefik.servicecors.frontend.rule: "Method:OPTIONS;HostRegexp:{subdomain:([0-9A-Za-z_-]+.)?}${COMPOSE_HOSTNAME}"
traefik.port: 80
<< : *default-labels
links:
- nginx # links varnish to the nginx in this docker-compose project, or it would try to connect to any nginx running in docker
<< : *container-defaults
environment:
<< : *default-environment
LISTEN: ":80"
VARNISH_BACKEND_HOST: nginx
VARNISH_BYPASS: "true" # by default we bypass varnish, change to 'false' or remove in order to tell varnish to cache if possible
networks:
<< : *add-traefik
networks:
traefik:
name: traefik
volumes:
data-volume: