# GPU Worker Development Override
#
# Usage: docker stack deploy -c docker-compose.yml -c docker-compose.gpu-dev.yml celery
# Or for quick testing: docker-compose -f docker-compose.yml -f docker-compose.gpu-dev.yml up l1-gpu-worker
#
# Features:
# - Mounts source code for instant changes (no rebuild needed)
# - Uses watchmedo for auto-reload on file changes
# - Shows config on startup

version: '3.8'

services:
  l1-gpu-worker:
    # Override command to use watchmedo for auto-reload
    command: >
      sh -c "
        pip install -q watchdog[watchmedo] 2>/dev/null || true;
        echo '=== GPU WORKER DEV MODE ===';
        echo 'Source mounted - changes take effect on restart';
        echo 'Auto-reload enabled via watchmedo';
        env | grep -E 'STREAMING_GPU|IPFS_GATEWAY|REDIS|DATABASE' | sort;
        echo '===========================';
        watchmedo auto-restart --directory=/app --pattern='*.py' --recursive -- \
          celery -A celery_app worker --loglevel=info -E -Q gpu,celery
      "
    environment:
      # Development defaults (can override with .env)
      - STREAMING_GPU_PERSIST=0
      - IPFS_GATEWAY_URL=https://celery-artdag.rose-ash.com/ipfs
      - SHOW_CONFIG=1
    volumes:
      # Mount source code for hot reload
      - ./:/app:ro
      # Keep cache local
      - gpu_cache:/data/cache
