Spaces:
Sleeping
Sleeping
File size: 1,351 Bytes
5476705 ed55a27 5476705 ed55a27 5476705 d3923ff ed55a27 5476705 ccc2cf9 5476705 ed55a27 d3923ff ed55a27 d3923ff ed55a27 5476705 d3923ff 5476705 d3923ff ed55a27 5476705 ed55a27 d3923ff | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | 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"] |