version: '3.8'

services:
  web:
    image: php:8.1-apache
    container_name: lms_crm_web
    ports:
      - "8080:80"
    volumes:
      - .:/var/www/html
    depends_on:
      - db
    environment:
      - DB_HOST=db
      - DB_NAME=lms_crm
      - DB_USER=root
      - DB_PASS=rootpassword

  db:
    image: mysql:8.0
    container_name: lms_crm_db
    environment:
      MYSQL_ROOT_PASSWORD: rootpassword
      MYSQL_DATABASE: lms_crm
    volumes:
      - db_data:/var/lib/mysql
      - ./db.sql:/docker-entrypoint-initdb.d/init.sql
    ports:
      - "3306:3306"

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: lms_crm_pma
    environment:
      PMA_HOST: db
      PMA_USER: root
      PMA_PASSWORD: rootpassword
    ports:
      - "8081:80"
    depends_on:
      - db

volumes:
  db_data: