services:
  mysql:
    image: mysql:8
    container_name: ytplayer-mysql
    restart: unless-stopped
    environment:
      MYSQL_DATABASE: ytplayer
      MYSQL_USER: ytplayer
      MYSQL_PASSWORD: ytplayer_dev_password
      MYSQL_ROOT_PASSWORD: root_dev_password
    ports:
      # Host 3308 -> container 3306. Not 3306 or 3307 — both already taken
      # by other unrelated projects' MySQL containers on this machine
      # (confirmed via `lsof`/`docker ps` before picking this).
      - "3308:3306"
    volumes:
      - ytplayer_mysql_data:/var/lib/mysql
      - ./server/db/schema.sql:/docker-entrypoint-initdb.d/01-schema.sql:ro
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-proot_dev_password"]
      interval: 5s
      timeout: 5s
      retries: 10

  adminer:
    image: adminer
    container_name: ytplayer-adminer
    restart: unless-stopped
    ports:
      - "8090:8080"
    depends_on:
      - mysql

volumes:
  ytplayer_mysql_data:
