
services:
  php:
    build:
        context: .
        dockerfile: php.dockerfile
    container_name: php-container
    volumes:
      - ./src:/var/www/html
    ports:
      - "8080:80"
    networks:
      - app-network

  mysql:
    image: mysql:latest
    container_name: mysql-container
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: rootpassword
      MYSQL_DATABASE: mydatabase
      MYSQL_USER: user
      MYSQL_PASSWORD: userpassword
    volumes:
      - db_data:/var/lib/mysql
    ports:
      - "3306:3306"
    networks:
      - app-network

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: phpmyadmin-container
    environment:
      PMA_HOST: mysql
      MYSQL_ROOT_PASSWORD: rootpassword
    ports:
      - "8081:80"
    depends_on:
      - mysql
    networks:
      - app-network

volumes:
  db_data:
  pg_data:

networks:
  app-network:
    driver: bridge

