version: '3.7'
services:
  apache:
    build: .docker/apache
    container_name: collection_v3_api_apache
    ports:
      -
        target: 80
        published: 1402
        mode: 'host'
    volumes:
      -
        type: 'bind'
        source: '.docker/config/vhosts'
        target: '/etc/apache2/sites-enabled'
      - type: 'bind'
        source: '.'
        target: '/home/wwwroot/collection-api'
        consistency: 'delegated'
      - type: 'bind'
        source: './var/cache'
        target: '/home/wwwroot/collection-api/var/cache'
      - type: 'bind'
        source: './var/log'
        target: '/home/wwwroot/collection-api/var/log'
      - type: 'bind'
        source: './vendor'
        target: '/home/wwwroot/collection-api/vendor'
        consistency: 'cached'
    depends_on:
      - php

  mysql:
    image: mariadb:10.7.1
    container_name: collection_v3_api_mysql
    ports:
      - '3306:3306'
    volumes:
      -
        type: 'bind'
        source: '.docker/data/db'
        target: '/var/lib/mariadb'
    command:
      - "--lower_case_table_names=2"
    environment:
      MARIADB_ROOT_PASSWORD: passwd
      MARIADB_DATABASE: collection
      MARIADB_USER: adrien
      MARIADB_PASSWORD: passwd

  php:
    build: .docker/php
    container_name: collection_v3_api_php
    volumes:
      -
        type: 'bind'
        source: '.'
        target: '/home/wwwroot/collection-api'
        consistency: 'delegated'
      - type: 'bind'
        source: './var/cache'
        target: '/home/wwwroot/collection-api/var/cache'
      - type: 'bind'
        source: './var/log'
        target: '/home/wwwroot/collection-api/var/log'
      - type: 'bind'
        source: './vendor'
        target: '/home/wwwroot/collection-api/vendor'
        consistency: 'cached'
    environment:
      - PHP_OPCACHE_VALIDATE_TIMESTAMPS=1
      - maildev_host=ad-delvallee_maildev
    depends_on:
      - mysql

  phpmyadmin:
    image: phpmyadmin:latest
    container_name: collection_v3_api_phpmyadmin
    environment:
      PMA_HOST: mysql
      PMA_PORT: 3306
    ports:
      -
        target: 80
        published: 8082
        mode: 'host'
    links:
      - mysql
