version: "3.8"

services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: app
    restart: always
    ports:
      - 8023:8000
      - 5678:5678  # Debugger port
    volumes:
      - ./:/app
      - shared-data:/app/downloads
    env_file:
      - .env
    # depends_on:
    #   - redis
    # command: >
    #   sh -c "uvicorn src.main:app --host
  #######################################
  # Redis: Message broker for Celery
  #######################################
  redis:
    image: redis:7-alpine
    container_name: wine_match_redis
    ports:
      - 6389:6379
    command: redis-server --appendonly yes
    volumes:
      - redis-data:/data
    restart: always

  worker:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: wine_match_worker
    command:
      - "celery"
      - "-A" 
      - "src.celery.celery_app.celery_app"
      - "worker"
      - "-E"
      - "--beat"
      - "--loglevel=info"
    volumes:
      - ./:/app
      - shared-data:/app/downloads
    env_file:
      - .env

volumes:
  redis-data:
    driver: local