version: "3.8"
services:
  asterisk:
    image: mathewfrancisv/odbc_mariadb:v4.0.0
    container_name: mat_asterisk
    restart: always
    tty: true
    depends_on: 
      - mariadb
    volumes:
      - ./conf/odbc.ini:/etc/odbc.ini
      - ./conf/odbcinst.ini:/etc/odbcinst.ini
      - ./conf/asterisk/:/etc/asterisk/
      - ./recordings:/var/spool/asterisk/monitor #for call recording
      - ./conf/asterisk/queues.conf:/etc/asterisk/queues.conf
      - ./conf/asterisk/asterisk_sounds:/var/lib/asterisk/sounds
      
      - ./voicemail_data:/var/spool/asterisk/voicemail
    network_mode: "host"



  mariadb:
    image: mariadb
    container_name: mat_mariadb
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: rootpassword
      MYSQL_DATABASE: asterisk_db
      MYSQL_USER: asterisk_user
      MYSQL_PASSWORD: 12345
      MYSQL_TCP_PORT: 3308
    volumes:
      - ./mariadb_data:/var/lib/mysql      # Persistent data
    network_mode: "host"


  spring_app:
    image: mathewfrancisv/spring_alpine:v1.0.0
    container_name: springbackalpine
    restart: always
    tty: true
    depends_on: 
      - mariadb
      - asterisk    
    volumes:
      - ./springCezenPBX:/app  # Mount your Spring Boot project
      - maven_repo:/root/.m2  # Store Maven dependencies
    environment:
      SPRING_DATASOURCE_URL: jdbc:mariadb://localhost:3308/asterisk_db  # Use host.docker.internal
      SPRING_DATASOURCE_USERNAME: ${DB_USER}
      SPRING_DATASOURCE_PASSWORD: ${DB_PASS}
    network_mode: "host"  # Run in host mode

volumes:
  maven_repo:



    #
