version: "3.7"

services:
  web:
    container_name: claroline-web
    build:
      context: .
      dockerfile: .docker/web/Dockerfile
    ports:
      - "80:80"
    volumes:
      - ./config:/var/www/html/claroline/config
      - ./files:/var/www/html/claroline/files
      - ./public/js:/var/www/html/claroline/public/js
      - ./public/themes:/var/www/html/claroline/public/themes
      - ./var:/var/www/html/claroline/var
    depends_on:
      - db
    environment:
      - APP_URL=claroline.example.com
      - ENV=PROD
      - APP_ENV=prod
      - APP_DEBUG=0
      - NODE_ENV=production
      - DB_HOST=claroline-db
      - DB_NAME=claroline
      - DB_USER=claroline
      - DB_PASSWORD=claroline
      - SECRET="secret-claroline"
      - PLATFORM_NAME=Claroline
      - PLATFORM_SUPPORT_EMAIL=claroline@example.com
    networks:
      claroline_network:
        ipv4_address: 172.22.9.6

  db:
    container_name: claroline-db
    environment:
      MYSQL_ROOT_PASSWORD: claroline
      MYSQL_USER: claroline
      MYSQL_PASSWORD: claroline
      MYSQL_DATABASE: claroline
    image: mysql:8.0
    ports:
      - "3306:3306"
    volumes:
      - ../mysql:/var/lib/mysql
      - ./.docker/mysql:/etc/mysql/conf.d
    networks:
      claroline_network:
        ipv4_address: 172.22.9.5

networks:
  claroline_network:
    ipam:
      config:
        - subnet: 172.22.9.0/24
