services:
  moviepilot:
    image: jxxghp/moviepilot-v2:latest
    container_name: moviepilot-v2
    hostname: moviepilot-v2
    restart: unless-stopped
    stdin_open: true
    tty: true
    ports:
      - "2100:3000"
      - "3001:3001"
    volumes:
      # 本地卷宗挂载
      - /volume1/MultiMedia:/media
      - /volume2/docker/docker_projects/moviepilot/moviepilot-v2/config:/config
      - /volume2/docker/docker_projects/moviepilot/moviepilot-v2/core:/moviepilot/.cloakbrowser
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /volume2/docker/docker_projects/moviepilot/tr:/torrents
      - /volume2/docker/docker_projects/moviepilot/BT_backup:/BT_backup
    environment:
      - 'NGINX_PORT=3000'
      - 'PORT=3001'
      - 'PUID=0'
      - 'PGID=0'
      - 'UMASK=000'
      - 'TZ=Asia/Shanghai'
      - 'SUPERUSER=kun'
      - 'SUPERUSER_PASSWORD=sbdPUGCcu6Vyq'
      - 'DB_TYPE=postgresql'
      - 'DB_POSTGRESQL_HOST=postgresql'
      - 'DB_POSTGRESQL_PORT=5432'
      - 'DB_POSTGRESQL_DATABASE=moviepilot'
      - 'DB_POSTGRESQL_USERNAME=moviepilot'
      - 'DB_POSTGRESQL_PASSWORD=pg_password'
      - 'CACHE_BACKEND_TYPE=redis'
      - 'CACHE_BACKEND_URL=redis://:redis_password@redis:6379'
    depends_on:
      postgresql:
        condition: service_healthy
      redis:
        condition: service_healthy
    networks:
      - moviepilot_net


  redis:
    image: redis:7-alpine
    container_name: moviepilot-redis
    restart: unless-stopped
    command: redis-server --save 600 1 --requirepass redis_password
    volumes:
      # 本地卷宗挂载
      - /volume2/docker/docker_projects/moviepilot/redis/data:/data
    healthcheck:
      test: ["CMD", "redis-cli", "--raw", "incr", "ping"]
      interval: 10s
      timeout: 5s
      retries: 5
    networks:
      - moviepilot_net

  postgresql:
    image: postgres:18.4
    container_name: moviepilot-postgresql
    restart: unless-stopped
    environment:
      POSTGRES_DB: moviepilot
      POSTGRES_USER: moviepilot
      POSTGRES_PASSWORD: pg_password
      TZ: Asia/Shanghai
    volumes:
      # 本地卷宗挂载
      - /volume2/docker/docker_projects/moviepilot/postgresql/data:/var/lib/postgresql
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U moviepilot -d moviepilot"]
      interval: 10s
      timeout: 5s
      retries: 5
    networks:
      - moviepilot_net


networks:
  moviepilot_net:
    driver: bridge