Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +26 -7
Dockerfile
CHANGED
|
@@ -2,14 +2,23 @@ FROM python:3.10-slim
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
# Install system dependencies
|
| 6 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 7 |
-
|
| 8 |
sqlite3 \
|
| 9 |
ca-certificates \
|
| 10 |
libgomp1 \
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
|
|
|
|
|
|
|
|
|
|
| 13 |
# Copy requirements and install Python packages
|
| 14 |
COPY requirements.txt .
|
| 15 |
RUN pip install --no-cache-dir --upgrade pip && \
|
|
@@ -18,11 +27,14 @@ RUN pip install --no-cache-dir --upgrade pip && \
|
|
| 18 |
# Upgrade Gemini SDK for v1 API
|
| 19 |
RUN pip install --no-cache-dir --upgrade google-generativeai google-ai-generativelanguage
|
| 20 |
|
|
|
|
|
|
|
|
|
|
| 21 |
# Copy application code
|
| 22 |
COPY . .
|
| 23 |
|
| 24 |
# Create necessary directories
|
| 25 |
-
RUN mkdir -p /app/data/logs /app/data/docs && chmod -R 777 /app/data
|
| 26 |
|
| 27 |
# Create __init__.py files (INCLUDING AGENT DIRECTORY)
|
| 28 |
RUN touch backend/__init__.py \
|
|
@@ -31,16 +43,23 @@ RUN touch backend/__init__.py \
|
|
| 31 |
&& touch backend/app/api/__init__.py \
|
| 32 |
&& touch backend/app/agent/__init__.py \
|
| 33 |
&& touch backend/app/wrappers/__init__.py \
|
|
|
|
| 34 |
&& touch backend/ingest/__init__.py
|
| 35 |
|
| 36 |
# Verify agent files exist (will fail build if missing)
|
| 37 |
RUN test -f backend/app/agent/agent_orchestrator.py || \
|
| 38 |
(echo "ERROR: agent_orchestrator.py not found! Add it before building." && exit 1)
|
| 39 |
|
| 40 |
-
#
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
# Expose port
|
| 46 |
EXPOSE 7860
|
|
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
+
# Install system dependencies + OCR libraries
|
| 6 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
|
| 7 |
sqlite3 \
|
| 8 |
ca-certificates \
|
| 9 |
libgomp1 \
|
| 10 |
+
tesseract-ocr \
|
| 11 |
+
tesseract-ocr-eng \
|
| 12 |
+
libglib2.0-0 \
|
| 13 |
+
libsm6 \
|
| 14 |
+
libxext6 \
|
| 15 |
+
libxrender-dev \
|
| 16 |
+
libgl1-mesa-glx \
|
| 17 |
&& rm -rf /var/lib/apt/lists/*
|
| 18 |
|
| 19 |
+
# Verify Tesseract installation
|
| 20 |
+
RUN tesseract --version
|
| 21 |
+
|
| 22 |
# Copy requirements and install Python packages
|
| 23 |
COPY requirements.txt .
|
| 24 |
RUN pip install --no-cache-dir --upgrade pip && \
|
|
|
|
| 27 |
# Upgrade Gemini SDK for v1 API
|
| 28 |
RUN pip install --no-cache-dir --upgrade google-generativeai google-ai-generativelanguage
|
| 29 |
|
| 30 |
+
# Install EasyOCR (best free open-source OCR) + dependencies
|
| 31 |
+
RUN pip install --no-cache-dir easyocr opencv-python-headless Pillow pytesseract
|
| 32 |
+
|
| 33 |
# Copy application code
|
| 34 |
COPY . .
|
| 35 |
|
| 36 |
# Create necessary directories
|
| 37 |
+
RUN mkdir -p /app/data/logs /app/data/docs /app/backend/app/db && chmod -R 777 /app/data
|
| 38 |
|
| 39 |
# Create __init__.py files (INCLUDING AGENT DIRECTORY)
|
| 40 |
RUN touch backend/__init__.py \
|
|
|
|
| 43 |
&& touch backend/app/api/__init__.py \
|
| 44 |
&& touch backend/app/agent/__init__.py \
|
| 45 |
&& touch backend/app/wrappers/__init__.py \
|
| 46 |
+
&& touch backend/app/db/__init__.py \
|
| 47 |
&& touch backend/ingest/__init__.py
|
| 48 |
|
| 49 |
# Verify agent files exist (will fail build if missing)
|
| 50 |
RUN test -f backend/app/agent/agent_orchestrator.py || \
|
| 51 |
(echo "ERROR: agent_orchestrator.py not found! Add it before building." && exit 1)
|
| 52 |
|
| 53 |
+
# ============================================
|
| 54 |
+
# INITIALIZE DATABASE (NEW)
|
| 55 |
+
# ============================================
|
| 56 |
+
# Copy db_init.py to the correct location
|
| 57 |
+
COPY backend/app/db/db_init.py backend/app/db/db_init.py
|
| 58 |
+
|
| 59 |
+
# Run database initialization
|
| 60 |
+
RUN echo "🗄️ Initializing database..." && \
|
| 61 |
+
python backend/app/db/db_init.py && \
|
| 62 |
+
echo "✅ Database initialized successfully!"
|
| 63 |
|
| 64 |
# Expose port
|
| 65 |
EXPOSE 7860
|