Spaces:
Sleeping
Sleeping
| FROM python:3.10-slim | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| sqlite3 \ | |
| ca-certificates \ | |
| libgomp1 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy requirements and install Python packages | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # Upgrade Gemini SDK for v1 API | |
| RUN pip install --no-cache-dir --upgrade google-generativeai google-ai-generativelanguage | |
| # Copy application code | |
| COPY . . | |
| # Create necessary directories | |
| RUN mkdir -p /app/data/logs /app/data/docs && chmod -R 777 /app/data | |
| # Create __init__.py files (INCLUDING AGENT DIRECTORY) | |
| RUN touch backend/__init__.py \ | |
| && touch backend/feature_builder/__init__.py \ | |
| && touch backend/app/__init__.py \ | |
| && touch backend/app/api/__init__.py \ | |
| && touch backend/app/agent/__init__.py \ | |
| && touch backend/app/wrappers/__init__.py \ | |
| && touch backend/ingest/__init__.py | |
| # Verify agent files exist (will fail build if missing) | |
| RUN test -f backend/app/agent/agent_orchestrator.py || \ | |
| (echo "ERROR: agent_orchestrator.py not found! Add it before building." && exit 1) | |
| # Initialize database if it doesn't exist | |
| RUN if [ ! -f /app/data/invoices.db ]; then \ | |
| sqlite3 /app/data/invoices.db < backend/database/init_schema_sqlite.sql; \ | |
| fi | |
| # Expose port | |
| EXPOSE 7860 | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--timeout-keep-alive", "75"] |