diff --git a/backend/Dockerfile b/backend/Dockerfile index 1e512e64b..1e49ad6ed 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -3,22 +3,28 @@ FROM python:3.11.6-slim-bullseye WORKDIR /app # Install runtime dependencies -RUN apt-get update && apt-get install -y \ +RUN apt-get clean && apt-get update && apt-get install -y \ libgeos-dev \ libcurl4-openssl-dev \ libssl-dev \ binutils \ - pandoc \ curl \ git \ + autoconf \ + automake \ + build-essential \ + libtool \ + python-dev \ + build-essential \ + # Additional dependencies for document handling + libmagic-dev \ poppler-utils \ tesseract-ocr \ - libmagic-dev \ libreoffice \ libpq-dev \ gcc \ - wget \ - && rm -rf /var/lib/apt/lists/* + pandoc && \ + rm -rf /var/lib/apt/lists/* && apt-get clean # Install Supabase CLI RUN ARCHITECTURE=$(uname -m) && \ @@ -32,7 +38,15 @@ RUN ARCHITECTURE=$(uname -m) && \ rm supabase_1.163.6_linux_arm64.deb; \ fi -COPY . . +COPY requirements.lock pyproject.toml README.md ./ +COPY api/pyproject.toml api/README.md ./api/ +COPY api/quivr_api/__init__.py ./api/quivr_api/__init__.py +COPY core/pyproject.toml core/README.md ./core/ +COPY core/quivr_core/__init__.py ./core/quivr_core/__init__.py +COPY worker/pyproject.toml worker/README.md ./worker/ +COPY worker/quivr_worker/__init__.py ./worker/quivr_worker/__init__.py +COPY core/MegaParse/pyproject.toml core/MegaParse/README.md ./core/MegaParse/ +COPY core/MegaParse/megaparse/__init__.py ./core/MegaParse/megaparse/__init__.py RUN PYTHONDONTWRITEBYTECODE=1 pip install --no-cache-dir -r requirements.lock @@ -43,4 +57,5 @@ RUN playwright install --with-deps && \ ENV PYTHONPATH=/app +COPY . . EXPOSE 5050 diff --git a/backend/api/quivr_api/modules/sync/utils/sync.py b/backend/api/quivr_api/modules/sync/utils/sync.py index 0ace4e5ed..9683283fa 100644 --- a/backend/api/quivr_api/modules/sync/utils/sync.py +++ b/backend/api/quivr_api/modules/sync/utils/sync.py @@ -6,6 +6,7 @@ from abc import ABC, abstractmethod from datetime import datetime from io import BytesIO from typing import Any, Dict, List, Optional, Union +from urllib.parse import urlparse import dropbox import markdownify @@ -25,7 +26,18 @@ from quivr_api.modules.sync.service.sync_notion import SyncNotionService from quivr_api.modules.sync.utils.normalize import remove_special_characters logger = get_logger(__name__) -redis_client = redis.Redis(host="redis", port=int(os.getenv("REDIS_PORT", 6379)), db=0) + +# Parse the CELERY_BROKER_URL +broker_url = os.getenv("CELERY_BROKER_URL", "redis://redis:6379/0") +parsed_url = urlparse(broker_url) + +# Create the Redis client using the parsed URL +redis_client = redis.Redis( + host=parsed_url.hostname, + port=parsed_url.port, + password=parsed_url.password, + db=int(parsed_url.path.lstrip('/')) +) class BaseSync(ABC):