build-configs/templates/docker-compose.yaml.twig

79 lines
1.7 KiB
Twig
Raw Normal View History

# {{ managedText | raw }}
2023-01-19 19:47:15 +00:00
x-app: &default-app
volumes:
- "${DOCKER_WEB_VOLUME:-./{{ drupal.docroot }}:{{ project_root }}/{{ drupal.docroot }}}"
2023-01-19 19:47:15 +00:00
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:
{% if dockerCompose.services.web != false %}
2023-01-19 19:47:15 +00:00
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 -%}
)"
2023-01-19 19:47:15 +00:00
profiles: [web]
{% endif %}
2023-01-19 19:47:15 +00:00
php:
<<: *default-app
build:
context: .
target: {{ dockerCompose.services.php.build.target }}
{% if "database" in dockerCompose.services|keys -%}
2023-01-19 19:47:15 +00:00
depends_on:
- database
{% endif -%}
2023-01-19 19:47:15 +00:00
profiles: [php]
{% if "database" in dockerCompose.services|keys %}
2023-01-19 19:47:15 +00:00
database:
image: {{ database.type }}:{{ database.version }}
2023-01-19 19:47:15 +00:00
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 -%}
2023-01-19 19:47:15 +00:00
networks:
web:
name: traefik_proxy