services:
  minio:
    image: minio/minio:latest
    container_name: svodka_minio_dev
    ports:
      - "9000:9000"  # API порт
      - "9001:9001"  # Консоль порт
    environment:
      MINIO_ROOT_USER: minioadmin
      MINIO_ROOT_PASSWORD: minioadmin
    command: server /data --console-address ":9001"
    volumes:
      - ./minio_data:/data
    restart: unless-stopped

  fastapi:
    build: ./python_parser
    container_name: svodka_fastapi_dev
    ports:
      - "8000:8000"
    environment:
      - MINIO_ENDPOINT=minio:9000
      - MINIO_ACCESS_KEY=minioadmin
      - MINIO_SECRET_KEY=minioadmin
      - MINIO_SECURE=false
      - MINIO_BUCKET=svodka-data
    depends_on:
      - minio
    restart: unless-stopped

  streamlit:
    image: python:3.11-slim
    container_name: svodka_streamlit_dev
    ports:
      - "8501:8501"
    environment:
      - API_BASE_URL=http://fastapi:8000
      - API_PUBLIC_URL=http://localhost:8000
      - MINIO_ENDPOINT=minio:9000
      - MINIO_ACCESS_KEY=minioadmin
      - MINIO_SECRET_KEY=minioadmin
      - MINIO_SECURE=false
      - MINIO_BUCKET=svodka-data
    volumes:
      # Монтируем исходный код для автоматической перезагрузки
      - ./streamlit_app:/app
      # Монтируем requirements.txt для установки зависимостей
      - ./streamlit_app/requirements.txt:/app/requirements.txt
    working_dir: /app
    depends_on:
      - minio
      - fastapi
    restart: unless-stopped
    command: >
      bash -c "
        pip install --no-cache-dir -r requirements.txt &&
        streamlit run streamlit_app.py --server.port=8501 --server.address=0.0.0.0 --server.runOnSave=true
      " 