version: '3'
services:
  apache:
    build: .docker/apache
    container_name: cv_api_apache
    ports:
      - "1212:80"
    volumes:
      - .docker/config/vhosts:/etc/apache2/sites-enabled
      - .:/home/wwwroot/cv-api:cached
      - appdata:/home/wwwroot/cv-api/var/cache
      - appdata:/home/wwwroot/cv-api/var/log
      - ./vendor:/home/wwwroot/cv-api/vendor:delegated
    depends_on:
      - php

  php:
    build: .docker/php
    container_name: cv_api_php
    volumes:
      - ".:/home/wwwroot/cv-api:cached"
      - appdata:/home/wwwroot/cv-api/var/cache
      - appdata:/home/wwwroot/cv-api/var/log
      - ./vendor:/home/wwwroot/cv-api/vendor:delegated
    environment:
      - PHP_OPCACHE_VALIDATE_TIMESTAMPS=1
    depends_on:
      - mysql

  phpmyadmin:
    image: phpmyadmin:latest
    container_name: cv_api_phpmyadmin
    environment:
      PMA_HOST: mysql
      PMA_PORT: 3306
    ports:
      - "8085:80"
    links:
      - mysql

  mysql:
    image: mariadb:10.7.1
    container_name: cv_api_mysql
    volumes:
      - .docker/data/db:/var/lib/mariadb
    command:
      - "--lower_case_table_names=2"
    environment:
      MARIADB_ROOT_PASSWORD: passwd
      MARIADB_DATABASE: cv
      MARIADB_USER: adrien
      MARIADB_PASSWORD: passwd

volumes:
  appdata:
