mirror of
https://github.com/opdavies/build-configs.git
synced 2025-01-23 02:27:33 +00:00
Oliver Davies
1fb75c9d93
Allow for setting a `docroot` directory for Drupal projects. By default, I've set this to `web` as that's what the Drupal Composer scaffold projects use, but other platforms such as Acquia Cloud hosting use `docroot`. This is how it can be configured in `build.yaml`: ```yaml drupal: docroot: docroot ``` Fixes #2
75 lines
1.6 KiB
Twig
75 lines
1.6 KiB
Twig
x-app: &default-app
|
|
volumes:
|
|
- "${DOCKER_WEB_VOLUME:-./{{ drupal.docroot }}:/app/{{ drupal.docroot }}}"
|
|
env_file:
|
|
- .env
|
|
restart: "${DOCKER_RESTART_POLICY:-unless-stopped}"
|
|
networks:
|
|
- default
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: "${DOCKER_MYSQL_CPUS:-0}"
|
|
memory: "${DOCKER_MYSQL_MEMORY:-0}"
|
|
labels:
|
|
- "traefik.enabled=false"
|
|
tty: true
|
|
|
|
services:
|
|
web:
|
|
<<: *default-app
|
|
build:
|
|
context: .
|
|
target: web
|
|
depends_on:
|
|
- php
|
|
networks:
|
|
- default
|
|
- web
|
|
labels:
|
|
- "traefik.docker.network=traefik_proxy"
|
|
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}.rule=Host(
|
|
`${COMPOSE_PROJECT_NAME}.localhost`,
|
|
{% for host in web.extra_hosts | default([]) -%}
|
|
{{ '`' ~ host ~ '`,' }}
|
|
{% endfor -%}
|
|
)"
|
|
profiles: [web]
|
|
|
|
php:
|
|
<<: *default-app
|
|
build:
|
|
context: .
|
|
target: {{ dockerCompose.services.php.build.target }}
|
|
{% if "database" in dockerCompose.services|keys -%}
|
|
depends_on:
|
|
- database
|
|
{% endif -%}
|
|
profiles: [php]
|
|
|
|
{% if "database" in dockerCompose.services|keys %}
|
|
database:
|
|
image: {{ database.type }}:{{ database.version }}
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: "${DOCKER_MYSQL_CPUS:-0}"
|
|
memory: "${DOCKER_MYSQL_MEMORY:-0}"
|
|
volumes:
|
|
- db-data:/var/lib/mysql
|
|
env_file:
|
|
- .env
|
|
labels:
|
|
- "traefik.enabled=false"
|
|
environment:
|
|
MYSQL_RANDOM_ROOT_PASSWORD: true
|
|
profiles: [database]
|
|
|
|
volumes:
|
|
db-data: {}
|
|
{% endif -%}
|
|
|
|
networks:
|
|
web:
|
|
name: traefik_proxy
|