version: "3.1"

services:
  database:
    image: mysql:8
    healthcheck:
      test: mysqladmin ping -h 127.0.0.1 -u root --password=$$MYSQL_ROOT_PASSWORD
      interval: 5s
      timeout: 10s
      retries: 60
    volumes:
      - ./db_data:/var/lib/mysql
    networks:
      - ecolyo-agent-network
    ports:
      - 3306:3306
    environment:
      MYSQL_ROOT_PASSWORD: ${DATABASE_PASSWORD}
      MYSQL_DATABASE: ${DATABASE_NAME}

  phpmyadmin:
    image: phpmyadmin/phpmyadmin:latest
    depends_on:
      - database
    networks:
      - ecolyo-agent-network
    ports:
      - 8008:80
    environment:
      PMA_HOST: database

volumes:
  db_data:

networks:
  ecolyo-agent-network:
