version: "3.8"

services:
  php-apache:
    build:
      context: .
      dockerfile: Dockerfile
    image: php:8.2-apache
    container_name: php-apache
    volumes:
      - ./src:/var/www/html
    ports:
      - "8080:80"
    environment:
      APACHE_DOCUMENT_ROOT: /var/www/html
    working_dir: /var/www/html

  database:
    image: mysql:8.0
    container_name: mysql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: dev_db
      MYSQL_USER: dev_user
      MYSQL_PASSWORD: dev_pass
    ports:
      - "3306:3306"
    volumes:
      - ./data:/var/lib/mysql
  
  phpmyadmin:
    image: phpmyadmin:latest
    container_name: phpmyadmin
    depends_on:
      - database
    environment:
      PMA_HOST: database
      MYSQL_ROOT_PASSWORD: root
    ports:
      - "8081:80"