version: '3.8'

services:
  app:
    build:
      context: .
      dockerfile: docker/php/Dockerfile
    container_name: multi_institution_app
    restart: unless-stopped
    working_dir: /var/www/html
    volumes:
      - ./:/var/www/html:cached
    networks:
      - multi_institution_network
    ports:
      - "8000:80"
    depends_on:
      - db
    extra_hosts:
      - "multi_institution.loc:127.0.0.1"

  db:
    image: mysql:8.0
    container_name: multi_institution_db
    restart: unless-stopped
    environment:
      MYSQL_DATABASE: ${DB_DATABASE:-multi_institution}
      MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD:-root}
      MYSQL_PASSWORD: ${DB_PASSWORD:-password}
      MYSQL_USER: ${DB_USERNAME:-multi_institution}
    volumes:
      - multi_institution_db_data:/var/lib/mysql
      - ./docker/mysql/my.cnf:/etc/mysql/conf.d/custom.cnf
    networks:
      - multi_institution_network
    ports:
      - "33061:3306"

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: multi_institution_phpmyadmin
    restart: unless-stopped
    environment:
      PMA_HOST: db
      PMA_PORT: 3306
      PMA_USER: ${DB_USERNAME:-multi_institution}
      PMA_PASSWORD: ${DB_PASSWORD:-password}
      UPLOAD_LIMIT: 300M
    ports:
      - "8080:80"
    depends_on:
      - db
    networks:
      - multi_institution_network

networks:
  multi_institution_network:
    driver: bridge

volumes:
  multi_institution_db_data:
    driver: local