services:
  db:
    container_name: MySQL_Infinity_Roma
    image: mysql:8.2.0
    volumes:
      - roma-db:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: password
    networks:
      - stage-dev-roma

  phpmyadmin:
    depends_on:
      - db
    container_name: PhpMyAdmin_Infinity_Roma
    image: phpmyadmin:5.2.1
    ports:
      - 8082:80
    networks:
      - stage-dev-roma
    environment:
      PMA_HOST: MySQL_Infinity_Roma

  php:
    container_name: PHP_Infinity_Roma
    image: base:1.0
    volumes:
      - type: bind
        source: ${PROJECT_PATH}
        target: /app
    networks:
      - stage-dev-roma
    ports:
      - 8080:8080
    command: bash -c "cd /app && if [ ! -d 'vendor' ]; then composer install; fi && php -S 0.0.0.0:8080 -t public/ public/index.php"

networks:
  stage-dev-roma:
    driver: bridge
volumes:
  roma-db:
    external: true
