version: '3.8'

services:
  # FreshRSS - 主 RSS 阅读器
  freshrss:
    image: freshrss/freshrss:latest
    container_name: freshrss
    restart: unless-stopped
    ports:
      - "8080:80"
    volumes:
      - freshrss-data:/var/www/FreshRSS/data
    environment:
      - TZ=Asia/Shanghai
      - CRON_MIN=*/15  # 每 15 分钟刷新一次
    depends_on:
      - db
    networks:
      - rss-network

  # MariaDB 数据库
  db:
    image: mariadb:10.11
    container_name: freshrss-db
    restart: unless-stopped
    environment:
      - TZ=Asia/Shanghai
      - MYSQL_ROOT_PASSWORD=freshrss_root_password_2026
      - MYSQL_DATABASE=freshrss
      - MYSQL_USER=freshrss
      - MYSQL_PASSWORD=freshrss_user_password_2026
    volumes:
      - db-data:/var/lib/mysql
    networks:
      - rss-network

  # RSSHub - 生成额外订阅源
  rsshub:
    image: diygod/rsshub:latest
    container_name: rsshub
    restart: unless-stopped
    ports:
      - "1200:1200"
    environment:
      - TZ=Asia/Shanghai
      - NODE_ENV=production
      - CACHE_TYPE=redis
      - REDIS_URL=redis://redis:6379/
    depends_on:
      - redis
    networks:
      - rss-network

  # Redis - RSSHub 缓存
  redis:
    image: redis:7-alpine
    container_name: rsshub-redis
    restart: unless-stopped
    volumes:
      - redis-data:/data
    networks:
      - rss-network

volumes:
  freshrss-data:
  db-data:
  redis-data:

networks:
  rss-network:
    driver: bridge
