Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +42 -35
Dockerfile
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
#
|
| 7 |
-
#
|
| 8 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 9 |
sqlite3 \
|
| 10 |
ca-certificates \
|
|
@@ -17,53 +20,55 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 17 |
libxrender-dev \
|
| 18 |
libgl1 \
|
| 19 |
build-essential \
|
|
|
|
|
|
|
|
|
|
| 20 |
&& rm -rf /var/lib/apt/lists/*
|
| 21 |
|
| 22 |
# Verify Tesseract installation
|
| 23 |
RUN tesseract --version
|
| 24 |
|
| 25 |
-
#
|
| 26 |
-
# Copy requirements
|
| 27 |
-
#
|
| 28 |
COPY requirements.txt .
|
| 29 |
|
| 30 |
-
# --------------------------------------------
|
| 31 |
-
# Upgrade pip + build tools
|
| 32 |
-
# --------------------------------------------
|
| 33 |
RUN pip install --no-cache-dir --upgrade pip setuptools wheel cython
|
| 34 |
|
| 35 |
-
#
|
| 36 |
-
#
|
| 37 |
-
#
|
| 38 |
-
|
| 39 |
-
# --------------------------------------------
|
| 40 |
-
RUN pip install --no-cache-dir --upgrade --force-reinstall numpy==1.24.4
|
| 41 |
-
RUN pip install --no-cache-dir --upgrade --force-reinstall --no-binary :all: pandas==2.0.3
|
| 42 |
|
| 43 |
-
#
|
| 44 |
-
# Install
|
| 45 |
-
#
|
| 46 |
-
RUN pip install --no-cache-dir
|
| 47 |
|
| 48 |
-
#
|
| 49 |
-
|
|
|
|
|
|
|
| 50 |
|
| 51 |
-
#
|
|
|
|
|
|
|
|
|
|
| 52 |
RUN pip install --no-cache-dir easyocr opencv-python-headless Pillow pytesseract
|
| 53 |
|
| 54 |
-
#
|
| 55 |
# Copy application code
|
| 56 |
-
#
|
| 57 |
COPY . .
|
| 58 |
|
| 59 |
-
#
|
| 60 |
# Create necessary directories
|
| 61 |
-
#
|
| 62 |
RUN mkdir -p /app/data/logs /app/data/docs /app/backend/app/db && chmod -R 777 /app/data
|
| 63 |
|
| 64 |
-
#
|
| 65 |
# Create __init__.py files
|
| 66 |
-
#
|
| 67 |
RUN touch backend/__init__.py \
|
| 68 |
&& touch backend/feature_builder/__init__.py \
|
| 69 |
&& touch backend/app/__init__.py \
|
|
@@ -73,26 +78,28 @@ RUN touch backend/__init__.py \
|
|
| 73 |
&& touch backend/app/db/__init__.py \
|
| 74 |
&& touch backend/ingest/__init__.py
|
| 75 |
|
|
|
|
| 76 |
# Verify agent files exist
|
|
|
|
| 77 |
RUN test -f backend/app/agent/agent_orchestrator.py || \
|
| 78 |
(echo "ERROR: agent_orchestrator.py not found! Add it before building." && exit 1)
|
| 79 |
|
| 80 |
-
#
|
| 81 |
# Initialize database
|
| 82 |
-
#
|
| 83 |
COPY backend/app/db/db_init.py backend/app/db/db_init.py
|
| 84 |
RUN echo "🗄️ Initializing database during build..." && \
|
| 85 |
python backend/app/db/db_init.py && \
|
| 86 |
echo "✅ Database initialized successfully!"
|
| 87 |
|
| 88 |
-
#
|
| 89 |
# Expose port
|
| 90 |
-
#
|
| 91 |
EXPOSE 7860
|
| 92 |
|
| 93 |
-
#
|
| 94 |
# Startup script
|
| 95 |
-
#
|
| 96 |
RUN echo '#!/bin/bash\n\
|
| 97 |
echo "🔍 Checking database..."\n\
|
| 98 |
python backend/app/db/db_init.py\n\
|
|
|
|
| 1 |
+
# ===============================
|
| 2 |
+
# Base image
|
| 3 |
+
# ===============================
|
| 4 |
FROM python:3.10-slim
|
| 5 |
|
| 6 |
WORKDIR /app
|
| 7 |
|
| 8 |
+
# ===============================
|
| 9 |
+
# System dependencies + OCR libraries
|
| 10 |
+
# ===============================
|
| 11 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 12 |
sqlite3 \
|
| 13 |
ca-certificates \
|
|
|
|
| 20 |
libxrender-dev \
|
| 21 |
libgl1 \
|
| 22 |
build-essential \
|
| 23 |
+
gcc \
|
| 24 |
+
g++ \
|
| 25 |
+
python3-dev \
|
| 26 |
&& rm -rf /var/lib/apt/lists/*
|
| 27 |
|
| 28 |
# Verify Tesseract installation
|
| 29 |
RUN tesseract --version
|
| 30 |
|
| 31 |
+
# ===============================
|
| 32 |
+
# Copy requirements and upgrade pip
|
| 33 |
+
# ===============================
|
| 34 |
COPY requirements.txt .
|
| 35 |
|
|
|
|
|
|
|
|
|
|
| 36 |
RUN pip install --no-cache-dir --upgrade pip setuptools wheel cython
|
| 37 |
|
| 38 |
+
# ===============================
|
| 39 |
+
# Install NumPy first (prebuilt wheel)
|
| 40 |
+
# ===============================
|
| 41 |
+
RUN pip install --no-cache-dir numpy==1.24.4
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
+
# ===============================
|
| 44 |
+
# Install Pandas from prebuilt wheel (avoid --no-binary)
|
| 45 |
+
# ===============================
|
| 46 |
+
RUN pip install --no-cache-dir pandas==2.0.3 --only-binary=:all:
|
| 47 |
|
| 48 |
+
# ===============================
|
| 49 |
+
# Install remaining dependencies
|
| 50 |
+
# ===============================
|
| 51 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 52 |
|
| 53 |
+
# ===============================
|
| 54 |
+
# Optional: Gemini SDK, EasyOCR
|
| 55 |
+
# ===============================
|
| 56 |
+
RUN pip install --no-cache-dir --upgrade google-generativeai google-ai-generativelanguage
|
| 57 |
RUN pip install --no-cache-dir easyocr opencv-python-headless Pillow pytesseract
|
| 58 |
|
| 59 |
+
# ===============================
|
| 60 |
# Copy application code
|
| 61 |
+
# ===============================
|
| 62 |
COPY . .
|
| 63 |
|
| 64 |
+
# ===============================
|
| 65 |
# Create necessary directories
|
| 66 |
+
# ===============================
|
| 67 |
RUN mkdir -p /app/data/logs /app/data/docs /app/backend/app/db && chmod -R 777 /app/data
|
| 68 |
|
| 69 |
+
# ===============================
|
| 70 |
# Create __init__.py files
|
| 71 |
+
# ===============================
|
| 72 |
RUN touch backend/__init__.py \
|
| 73 |
&& touch backend/feature_builder/__init__.py \
|
| 74 |
&& touch backend/app/__init__.py \
|
|
|
|
| 78 |
&& touch backend/app/db/__init__.py \
|
| 79 |
&& touch backend/ingest/__init__.py
|
| 80 |
|
| 81 |
+
# ===============================
|
| 82 |
# Verify agent files exist
|
| 83 |
+
# ===============================
|
| 84 |
RUN test -f backend/app/agent/agent_orchestrator.py || \
|
| 85 |
(echo "ERROR: agent_orchestrator.py not found! Add it before building." && exit 1)
|
| 86 |
|
| 87 |
+
# ===============================
|
| 88 |
# Initialize database
|
| 89 |
+
# ===============================
|
| 90 |
COPY backend/app/db/db_init.py backend/app/db/db_init.py
|
| 91 |
RUN echo "🗄️ Initializing database during build..." && \
|
| 92 |
python backend/app/db/db_init.py && \
|
| 93 |
echo "✅ Database initialized successfully!"
|
| 94 |
|
| 95 |
+
# ===============================
|
| 96 |
# Expose port
|
| 97 |
+
# ===============================
|
| 98 |
EXPOSE 7860
|
| 99 |
|
| 100 |
+
# ===============================
|
| 101 |
# Startup script
|
| 102 |
+
# ===============================
|
| 103 |
RUN echo '#!/bin/bash\n\
|
| 104 |
echo "🔍 Checking database..."\n\
|
| 105 |
python backend/app/db/db_init.py\n\
|