version: '3.8'

services:
  # Clean installation test container
  claude-mpm-clean:
    build:
      context: ..
      dockerfile: docker/Dockerfile.clean-install
    image: claude-mpm:clean-install
    container_name: claude-mpm-clean-test
    environment:
      - PYTHONUNBUFFERED=1
      - CLAUDE_MPM_LOG_LEVEL=DEBUG
    volumes:
      # Mount logs directory for inspection
      - claude-mpm-logs:/home/claude/.claude-mpm/logs
      # Optional: Mount a test project directory
      # - ./test-project:/home/claude/test-project
    networks:
      - claude-mpm-net
    stdin_open: true
    tty: true
    command: ["/home/claude/verify_installation.sh"]

  # Interactive testing container
  claude-mpm-interactive:
    build:
      context: ..
      dockerfile: docker/Dockerfile.clean-install
    image: claude-mpm:clean-install
    container_name: claude-mpm-interactive
    environment:
      - PYTHONUNBUFFERED=1
      - CLAUDE_MPM_LOG_LEVEL=INFO
    volumes:
      - claude-mpm-logs:/home/claude/.claude-mpm/logs
      - claude-mpm-config:/home/claude/.claude-mpm/config
      - claude-mpm-memories:/home/claude/.claude-mpm/memories
    networks:
      - claude-mpm-net
    stdin_open: true
    tty: true
    command: ["/bin/bash"]
    profiles:
      - interactive

  # Unit test runner container
  claude-mpm-test:
    build:
      context: ..
      dockerfile: docker/Dockerfile.clean-install
    image: claude-mpm:clean-install
    container_name: claude-mpm-test-runner
    environment:
      - PYTHONUNBUFFERED=1
      - PYTEST_VERBOSE=1
    working_dir: /app
    command: |
      bash -c "
        pip install --user pytest pytest-asyncio pytest-cov &&
        python -m pytest tests/ -v --tb=short --maxfail=5 -k 'not e2e' ||
        echo 'Some tests failed, but installation is verified'
      "
    networks:
      - claude-mpm-net
    profiles:
      - test

  # Development container with hot reload
  claude-mpm-dev:
    build:
      context: ..
      dockerfile: docker/Dockerfile.clean-install
    image: claude-mpm:clean-install
    container_name: claude-mpm-dev
    environment:
      - PYTHONUNBUFFERED=1
      - CLAUDE_MPM_LOG_LEVEL=DEBUG
      - FLASK_ENV=development
    volumes:
      # Mount source code for development
      - ../src:/app/src:ro
      - ../scripts:/app/scripts:ro
      - ../tests:/app/tests:ro
      - claude-mpm-logs:/home/claude/.claude-mpm/logs
      - claude-mpm-config:/home/claude/.claude-mpm/config
      - claude-mpm-memories:/home/claude/.claude-mpm/memories
    networks:
      - claude-mpm-net
    ports:
      - "8080:8080"  # Hook service port
      - "5000:5000"  # Dashboard port
    stdin_open: true
    tty: true
    command: ["/bin/bash"]
    profiles:
      - dev

volumes:
  claude-mpm-logs:
    driver: local
  claude-mpm-config:
    driver: local
  claude-mpm-memories:
    driver: local

networks:
  claude-mpm-net:
    driver: bridge