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

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

  phpmyadmin:
    image: phpmyadmin:latest
    container_name: collection_v3_admin_phpmyadmin
    environment:
      PMA_HOST: mysql
      PMA_PORT: 3306
    ports:
      - "8084:80"
    links:
      - mysql

  node:
    build: .docker/node
    volumes:
      - .:/home/wwwroot/sf4
    container_name: collection_v3_admin_node
    command: bash -c "yarn && yarn encore dev --watch"

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

  redis:
    image: redis:5-alpine
    container_name: collection_v3_admin_redis
    ports: [ "6379" ]

  rabbitmq:
    image: rabbitmq:3.10-management
    container_name: collection_v3_admin_rabbit
    ports:
      - '5672:5672'
      - '15672:15672'

volumes:
  appdata:
