Spaces:
Sleeping
Sleeping
| # Use Python 3.11 as base image | |
| FROM python:3.11-slim | |
| # Set working directory | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| curl \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy and install Python dependencies first (better caching) | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy application code | |
| COPY . . | |
| # Create necessary data directories for financial processing | |
| RUN mkdir -p /app/data/input \ | |
| /app/data/output \ | |
| /app/data/output1 \ | |
| /app/data/output2 \ | |
| /app/data/output3 \ | |
| /app/data/csv_notes_bs \ | |
| /app/data/csv_notes_cfs \ | |
| /app/data/csv_notes_pnl \ | |
| /app/data/generated_notes \ | |
| /app/data/generated_notes_excel \ | |
| && chmod -R 777 /app/data | |
| # Set environment variables | |
| ENV PYTHONPATH=/app | |
| ENV PYTHONUNBUFFERED=1 | |
| # Default agent configuration (can be overridden by .env) | |
| ENV AGENT_MODEL=gpt-3.5-turbo | |
| ENV AGENT_TEMPERATURE=0.1 | |
| ENV AGENT_MAX_TOKENS=2000 | |
| # Expose the port | |
| EXPOSE 7860 | |
| # Health check for the API | |
| HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \ | |
| CMD curl -f http://localhost:7860/docs || exit 1 | |
| # Start FastAPI app | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |