version: "3.8"

services:
  phpapache:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: codebeater_phpapache
    ports:
      - "8080:80"
    volumes:
      - ./src:/var/www/html
    depends_on:
      - db
    networks:
      - codebeater_net

  db:
    image: mysql:8.0
    container_name: codebeater_mysql
    command: --default-authentication-plugin=mysql_native_password
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: codebeater
      MYSQL_USER: admin
      MYSQL_PASSWORD: admin
    volumes:
      - db_codebeater:/var/lib/mysql
    networks:
      - codebeater_net

  phpmyadmin:
    image: phpmyadmin/phpmyadmin:latest
    container_name: codebeater_phpmyadmin
    ports:
      - "8081:80"
    environment:
      PMA_HOST: db
      PMA_PORT: 3306
    depends_on:
      - db
    networks:
      - codebeater_net

volumes:
  db_codebeater:

networks:
  codebeater_net:
    driver: bridge
