Spaces:
Sleeping
Sleeping
| FROM python:3.9-slim | |
| # Set working directory | |
| WORKDIR /app | |
| # Avoid permission and telemetry issues | |
| ENV TRANSFORMERS_CACHE=/app/cache \ | |
| HF_HOME=/app/cache \ | |
| STREAMLIT_HOME=/app/.streamlit \ | |
| XDG_CACHE_HOME=/app/.cache \ | |
| BROWSER_GATHERUSAGESTATS=false \ | |
| HF_HUB_DISABLE_TELEMETRY=1 \ | |
| PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| curl \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create cache and config directories with proper permissions | |
| RUN mkdir -p $STREAMLIT_HOME $XDG_CACHE_HOME $HF_HOME && \ | |
| chmod -R 777 /app | |
| # Copy requirements and source code | |
| COPY requirements.txt ./requirements.txt | |
| COPY src/ ./src/ | |
| COPY src/vectorstore_en_recursive/ ./vectorstore_en_recursive/ | |
| COPY src/vectorstore_bn_recursive/ ./vectorstore_bn_recursive/ | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # (Optional) Clear huggingface cache | |
| # RUN huggingface-cli delete-cache || true | |
| # Port to expose | |
| EXPOSE 8501 | |
| # Healthcheck (optional but helpful) | |
| HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1 | |
| # Run Streamlit | |
| ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"] |