services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    image: php-yii2-app:latest
    container_name: brandhub360_app
    volumes:
      - ./:/var/www/html
    ports:
      - "8080:80"
    environment:
      - PHP_ENV=development
      - DEVELOPMENT=${DEVELOPMENT}
      - STAGING=${STAGING}
      - DB_CONNECTION=${DB_CONNECTION}
      - DB_DATABASE=${DB_DATABASE}
      - DB_USERNAME=${DB_USERNAME}
      - DB_PASSWORD=${DB_PASSWORD}
      - DB_HOST=db

  db:
    image: mariadb:latest
    container_name: brandhub360_db
    volumes:
      - brandhub360_db_data:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}}
      MYSQL_DATABASE: ${DB_DATABASE}
      MYSQL_USER: ${DB_USERNAME}
      MYSQL_PASSWORD: ${DB_PASSWORD}
    ports:
      - "3306:3306"

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: phpmyadmin
    environment:
      PMA_HOST: db
      PMA_USER: ${DB_USERNAME}
      PMA_PASSWORD: ${DB_PASSWORD}
    ports:
      - "8081:80"
      - "8443:443"

volumes:
  brandhub360_db_data: