services:
  mysql:
    image: docker.1ms.run/mysql:8.0
    container_name: ruoyi-mysql
    # restart: unless-stopped
    ports:
      - "3306:3306"
    environment:
      MYSQL_ROOT_PASSWORD: password
      MYSQL_DATABASE: ry-vue
    volumes:
      - mysql_data:/var/lib/mysql
      - ./sql/ry_20250522.sql:/docker-entrypoint-initdb.d/01-ry_20250522.sql
      - ./sql/quartz.sql:/docker-entrypoint-initdb.d/02-quartz.sql
    command: >
      --default-authentication-plugin=mysql_native_password
      --character-set-server=utf8mb4
      --collation-server=utf8mb4_unicode_ci
    networks:
      - ruoyi-network
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-ppassword"]
      interval: 10s
      timeout: 5s
      retries: 3
      start_period: 30s

  redis:
    image: docker.1ms.run/redis:7-alpine
    container_name: ruoyi-redis
    # restart: unless-stopped
    ports:
      - "6379:6379"
    volumes:
      - redis_data:/data
    networks:
      - ruoyi-network
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 3s
      retries: 3

  phpmyadmin:
    image: docker.1ms.run/phpmyadmin:5
    container_name: ruoyi-phpmyadmin
    # restart: unless-stopped
    ports:
      - "8081:80"
    environment:
      PMA_HOST: mysql
      PMA_PORT: 3306
      MYSQL_ROOT_PASSWORD: password
    depends_on:
      - mysql
    networks:
      - ruoyi-network

  redisinsight:
    image: docker.1ms.run/redis/redisinsight:2.64
    container_name: ruoyi-redisinsight
    # restart: unless-stopped
    ports:
      - "8001:5540"
    volumes:
      - redisinsight_data:/data
    depends_on:
      - redis
    networks:
      - ruoyi-network

volumes:
  mysql_data:
  redis_data:
  redisinsight_data:

networks:
  ruoyi-network:
    driver: bridge
