Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +57 -46
Dockerfile
CHANGED
|
@@ -25,36 +25,46 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 25 |
python3-dev \
|
| 26 |
&& rm -rf /var/lib/apt/lists/*
|
| 27 |
|
| 28 |
-
# Verify Tesseract
|
| 29 |
RUN tesseract --version
|
| 30 |
|
| 31 |
# ===============================
|
| 32 |
-
#
|
| 33 |
-
# ===============================
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
# ===============================
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
# ===============================
|
| 60 |
# Copy application code
|
|
@@ -62,35 +72,35 @@ RUN pip install --no-cache-dir easyocr opencv-python-headless Pillow pytesseract
|
|
| 62 |
COPY . .
|
| 63 |
|
| 64 |
# ===============================
|
| 65 |
-
#
|
| 66 |
# ===============================
|
| 67 |
-
RUN mkdir -p /app/data/logs /app/data/docs /app/backend/app/db
|
|
|
|
| 68 |
|
| 69 |
# ===============================
|
| 70 |
-
#
|
| 71 |
# ===============================
|
| 72 |
RUN touch backend/__init__.py \
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
|
| 81 |
# ===============================
|
| 82 |
-
# Verify agent
|
| 83 |
# ===============================
|
| 84 |
RUN test -f backend/app/agent/agent_orchestrator.py || \
|
| 85 |
-
(echo "ERROR: agent_orchestrator.py
|
| 86 |
|
| 87 |
# ===============================
|
| 88 |
-
# Initialize database
|
| 89 |
# ===============================
|
| 90 |
-
|
| 91 |
-
RUN echo "ποΈ Initializing database during build..." && \
|
| 92 |
python backend/app/db/db_init.py && \
|
| 93 |
-
echo "β
Database
|
| 94 |
|
| 95 |
# ===============================
|
| 96 |
# Expose port
|
|
@@ -101,10 +111,11 @@ EXPOSE 7860
|
|
| 101 |
# Startup script
|
| 102 |
# ===============================
|
| 103 |
RUN echo '#!/bin/bash\n\
|
| 104 |
-
|
|
|
|
| 105 |
python backend/app/db/db_init.py\n\
|
| 106 |
-
echo "β
Database ready"\n\
|
| 107 |
-
echo "π Starting application
|
| 108 |
exec uvicorn app:app --host 0.0.0.0 --port 7860 --timeout-keep-alive 75\n\
|
| 109 |
' > /app/start.sh && chmod +x /app/start.sh
|
| 110 |
|
|
|
|
| 25 |
python3-dev \
|
| 26 |
&& rm -rf /var/lib/apt/lists/*
|
| 27 |
|
| 28 |
+
# Verify Tesseract
|
| 29 |
RUN tesseract --version
|
| 30 |
|
| 31 |
# ===============================
|
| 32 |
+
# Python tooling
|
| 33 |
+
# ===============================
|
| 34 |
+
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
|
| 35 |
+
|
| 36 |
+
# ===============================
|
| 37 |
+
# π CRITICAL: single dependency layer
|
| 38 |
+
# ===============================
|
| 39 |
+
RUN pip install --no-cache-dir \
|
| 40 |
+
numpy==1.24.4 \
|
| 41 |
+
pandas==2.0.3 \
|
| 42 |
+
fastapi==0.104.1 \
|
| 43 |
+
uvicorn[standard]==0.24.0 \
|
| 44 |
+
pydantic==2.5.0 \
|
| 45 |
+
scikit-learn==1.6.1 \
|
| 46 |
+
lightgbm==4.1.0 \
|
| 47 |
+
joblib==1.3.2 \
|
| 48 |
+
python-dateutil==2.8.2 \
|
| 49 |
+
filelock==3.13.1 \
|
| 50 |
+
python-multipart==0.0.6 \
|
| 51 |
+
httpx==0.25.2 \
|
| 52 |
+
redis==5.0.1 \
|
| 53 |
+
rq==1.15.1 \
|
| 54 |
+
pdfplumber==0.10.3 \
|
| 55 |
+
PyMuPDF==1.23.8 \
|
| 56 |
+
pytesseract==0.3.10 \
|
| 57 |
+
Pillow==10.1.0 \
|
| 58 |
+
python-magic==0.4.27 \
|
| 59 |
+
requests==2.31.0 \
|
| 60 |
+
python-dotenv==1.0.0 \
|
| 61 |
+
psycopg2-binary==2.9.7 \
|
| 62 |
+
SQLAlchemy==2.0.20 \
|
| 63 |
+
alembic==1.11.1 \
|
| 64 |
+
google-generativeai \
|
| 65 |
+
google-ai-generativelanguage \
|
| 66 |
+
easyocr \
|
| 67 |
+
opencv-python-headless
|
| 68 |
|
| 69 |
# ===============================
|
| 70 |
# Copy application code
|
|
|
|
| 72 |
COPY . .
|
| 73 |
|
| 74 |
# ===============================
|
| 75 |
+
# Runtime directories
|
| 76 |
# ===============================
|
| 77 |
+
RUN mkdir -p /app/data/logs /app/data/docs /app/backend/app/db \
|
| 78 |
+
&& chmod -R 777 /app/data
|
| 79 |
|
| 80 |
# ===============================
|
| 81 |
+
# Python package structure
|
| 82 |
# ===============================
|
| 83 |
RUN touch backend/__init__.py \
|
| 84 |
+
backend/feature_builder/__init__.py \
|
| 85 |
+
backend/app/__init__.py \
|
| 86 |
+
backend/app/api/__init__.py \
|
| 87 |
+
backend/app/agent/__init__.py \
|
| 88 |
+
backend/app/wrappers/__init__.py \
|
| 89 |
+
backend/app/db/__init__.py \
|
| 90 |
+
backend/ingest/__init__.py
|
| 91 |
|
| 92 |
# ===============================
|
| 93 |
+
# Verify agent file exists
|
| 94 |
# ===============================
|
| 95 |
RUN test -f backend/app/agent/agent_orchestrator.py || \
|
| 96 |
+
(echo "β ERROR: agent_orchestrator.py missing" && exit 1)
|
| 97 |
|
| 98 |
# ===============================
|
| 99 |
+
# Initialize database at build time
|
| 100 |
# ===============================
|
| 101 |
+
RUN echo "ποΈ Initializing database..." && \
|
|
|
|
| 102 |
python backend/app/db/db_init.py && \
|
| 103 |
+
echo "β
Database ready"
|
| 104 |
|
| 105 |
# ===============================
|
| 106 |
# Expose port
|
|
|
|
| 111 |
# Startup script
|
| 112 |
# ===============================
|
| 113 |
RUN echo '#!/bin/bash\n\
|
| 114 |
+
set -e\n\
|
| 115 |
+
echo \"π Checking database...\"\n\
|
| 116 |
python backend/app/db/db_init.py\n\
|
| 117 |
+
echo \"β
Database ready\"\n\
|
| 118 |
+
echo \"π Starting application...\"\n\
|
| 119 |
exec uvicorn app:app --host 0.0.0.0 --port 7860 --timeout-keep-alive 75\n\
|
| 120 |
' > /app/start.sh && chmod +x /app/start.sh
|
| 121 |
|