Spaces:
Sleeping
Sleeping
| FROM python:3.11-slim-bookworm | |
| WORKDIR /app | |
| # Install system dependencies including libgl1 for sentence-transformers | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| curl \ | |
| git \ | |
| sqlite3 \ | |
| libsqlite3-dev \ | |
| libgl1 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create cache directories with proper permissions | |
| RUN mkdir -p /tmp/cache/huggingface \ | |
| /tmp/cache/streamlit \ | |
| /tmp/chroma_db && \ | |
| chmod -R 777 /tmp | |
| # Set environment variables for cache locations | |
| ENV HF_HOME=/tmp/cache/huggingface \ | |
| STREAMLIT_HOME=/tmp/cache/streamlit \ | |
| XDG_CACHE_HOME=/tmp/cache | |
| # Copy requirements first for better layer caching | |
| COPY requirements.txt ./ | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy application code and PDF | |
| COPY . . | |
| # Expose the correct port | |
| EXPOSE 8503 | |
| # Health check | |
| HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \ | |
| CMD curl --fail http://localhost:8503/_stcore/health | |
| # Run the application | |
| ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", \ | |
| "--server.port=8503", \ | |
| "--server.address=0.0.0.0", \ | |
| "--server.headless=true", \ | |
| "--browser.gatherUsageStats=false"] |