forked from danskernesdigitalebibliotek/dpl-cms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
149 lines (139 loc) · 5.9 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
# This docker-compose file follows the best-practicis for a docker-compose setup
# used by a Lagoon based project.
# https://docs.lagoon.sh/lagoon/using-lagoon-the-basics/docker-compose-yml
#
# Note that this file is not actually processed by lagoon. Instead a specialized
# version is injected during deployment by the dpl-platform. As a consequence
# any major changes made to his file, will also need to be made to the version
# used during deployment.
#
# Consult https://github.com/danskernesdigitalebibliotek/dpl-platform for
# further details.
version: '2.3'
# This block is used for inclusion in the environment section of each container.
x-volumes:
&default-volumes
# Define all volumes you would like to have real-time mounted into the docker containers
volumes:
- 'projectroot:/app'
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: '1000'
x-environment:
&default-environment
# The php cli container needs this to be defined. Otherwise it is not possible to execute drush commands.
LAGOON_ROUTE: &default-url http://${COMPOSE_PROJECT_NAME}.docker
# Environment variables which mimic what will be set in a Lagoon cluster locally
LAGOON_PROJECT: 'dplcms'
LAGOON_ENVIRONMENT: 'local'
LAGOON_ENVIRONMENT_TYPE: ${LAGOON_ENVIRONMENT_TYPE:-local}
WEBROOT: web
# Uncomment if you like to have the system behave like in production
#LAGOON_ENVIRONMENT_TYPE: production
services:
varnish: # Caching HTTP reverse proxy that serves (mostly) anonymous requests.
# https://docs.lagoon.sh/lagoon/docker-images/varnish
image: uselagoon/varnish-6-drupal:latest
depends_on:
- nginx
labels:
lagoon.type: varnish
links:
- nginx # links varnish to the nginx in this docker-compose project, or it would try to connect to any nginx running in docker
<< : *default-user # uses the defined user from top
ports:
# Exposing the port to make it accessible locally without proxies.
- "8080"
environment:
<< : *default-environment
# VARNISH_BYPASS: "true" # Add this to disable caching in varnish.
# Is used by [nginx-proxy](https://github.com/nginx-proxy/nginx-proxy) or [dory](https://github.com/FreedomBen/dory)
VIRTUAL_HOST: ${COMPOSE_PROJECT_NAME}.docker
VIRTUAL_PORT: 8080
cli: # cli container, will be used for executing composer and any local commands (drush, drupal, etc.)
# https://docs.lagoon.sh/lagoon/docker-images/nginx/nginx-drupal
build:
context: .
dockerfile: lagoon/cli.dockerfile
image: &cli-image uselagoon/php-8.1-cli-drupal:latest # this image will be reused as `CLI_IMAGE` in subsequent Docker builds
<< : *default-volumes # loads the defined volumes from the top
user: root
environment:
<< : *default-environment # loads the defined environment variables from the top
# Uncomment to enable xdebug for cli tools
#XDEBUG_ENABLE: "true"
labels:
# Lagoon Labels
lagoon.type: cli-persistent
lagoon.persistent.name: nginx # mount the persistent storage of nginx into this container
lagoon.persistent: /app/web/sites/default/files/ # location where the persistent storage should be mounted
nginx: # Webserver in front of php-fpm. Serves static assets.
# https://docs.lagoon.sh/lagoon/docker-images/nginx/nginx-drupal
build:
context: .
dockerfile: lagoon/nginx.dockerfile
args:
CLI_IMAGE: *cli-image # Inject the name of the cli image
depends_on:
- php
# loads the defined volumes and user from the top
<<: [*default-volumes, *default-user]
environment:
<< : *default-environment # loads the defined environment variables from the top
# Route that should be used locally.
VIRTUAL_HOST: nginx.${COMPOSE_PROJECT_NAME}.docker
labels:
lagoon.type: nginx-php-persistent
lagoon.persistent: /app/web/sites/default/files/ # define where the persistent storage should be mounted too
php: # php-fpm server that executes php requests.
# https://docs.lagoon.sh/lagoon/docker-images/php-fpm
build:
context: .
dockerfile: lagoon/php.dockerfile
args:
CLI_IMAGE: *cli-image
depends_on:
redis:
condition: service_started
mariadb:
condition: service_healthy
# loads the defined volumes and user from the top
<<: [*default-volumes, *default-user]
environment:
<< : *default-environment # loads the defined environment variables from the top
XDEBUG_ENABLE: ${XDEBUG_ENABLE:-false}
labels:
lagoon.type: nginx-php-persistent
lagoon.name: nginx # we want this service be part of the nginx pod in Lagoon
lagoon.persistent: /app/web/sites/default/files/ # define where the persistent storage should be mounted too
mariadb: # Main site database.
# https://docs.lagoon.sh/lagoon/docker-images/mariadb/mariadb-drupal
image: uselagoon/mariadb-10.6-drupal:latest
labels:
lagoon.type: mariadb
# Do a periodic healthcheck. This is mainly used to block the php service
# from starting up before we have a healthy database.
healthcheck:
test: "/usr/share/container-scripts/mysql/readiness-probe.sh"
interval: 10s
ports:
- "3306" # exposes the port 3306 with a random local port, find it with `docker-compose port mariadb 3306`
<< : *default-user # uses the defined user from top
environment:
<< : *default-environment
redis: # In-memory key-value database used as the Drupal Core cache backend.
# https://docs.lagoon.sh/lagoon/docker-images/redis
image: uselagoon/redis-6:latest
labels:
lagoon.type: redis
<< : *default-user # uses the defined user from top
environment:
<< : *default-environment
volumes:
projectroot:
driver: local
driver_opts:
type: none
device: ${PWD}
o: bind