| # ===== HUST RAG Backend ===== | |
| FROM python:3.11-slim | |
| WORKDIR /app | |
| # Install dependencies first (cached layer) | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy project code | |
| COPY core/ core/ | |
| COPY scripts/ scripts/ | |
| COPY evaluation/ evaluation/ | |
| # Create data directory (mount at runtime) | |
| RUN mkdir -p data | |
| # Expose API port | |
| EXPOSE 8000 | |
| # Environment variables (override at runtime) | |
| ENV GROQ_API_KEY="" | |
| ENV SILICONFLOW_API_KEY="" | |
| ENV API_HOST="0.0.0.0" | |
| ENV API_PORT="8000" | |
| # Run download_data.py first (checks if data exists, downloads if not), then start FastAPI server | |
| CMD python scripts/download_data.py && python core/api/server.py | |