services:
  # MySQL
  mysql:
    image: mysql:8.4.0
    container_name: ${PROJECT_NAME}_mysql
    environment:
      MYSQL_USERNAME: ${MYSQL_USERNAME}
      MYSQL_PASSWORD: ${MYSQL_PASSWORD}
      MYSQL_DATABASE: ${MYSQL_DATABASE}
      MYSQL_RANDOM_ROOT_PASSWORD: "yes"
    ports:
      - "${MYSQL_PORT}:3306"
    volumes:
      - ./mysql:/var/lib/mysql
  
  # phpMyAdmin
  pma:
    image: phpmyadmin:5.2.1-apache
    container_name: ${PROJECT_NAME}_pma
    depends_on:
      - mysql
    environment:
      PMA_HOST: mysql
      PMA_PORT: 3306
      PMA_USER: ${MYSQL_USERNAME}
      PMA_PASSWORD: ${MYSQL_PASSWORD}
    ports:
      - "${PMA_PORT}:80"

  # PHP + Apache
  php:
    image: webdevops/php-apache:8.3
    container_name: ${PROJECT_NAME}_php
    depends_on:
      - mysql
    working_dir: /app
    environment:
      WEB_DOCUMENT_ROOT: /app/www
    ports:
      - "${PHP_PORT}:80"
    volumes:
      - .:/app
