Spaces:
Sleeping
Sleeping
| FROM python:3.9-slim | |
| # Set working directory to /app inside the container | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| curl \ | |
| software-properties-common \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create directories for cache and streamlit config | |
| RUN mkdir -p /app/.streamlit /app/.cache | |
| # Set environment variables for caching | |
| ENV TRANSFORMERS_CACHE=/app/.cache | |
| ENV HF_HOME=/app/.cache | |
| ENV TORCH_HOME=/app/.cache | |
| # Copy .streamlit config folder (including config.toml) | |
| COPY .streamlit/ .streamlit/ | |
| # Copy app files (chromadb_model is already in the Space repository) | |
| COPY app/ ./ | |
| COPY requirements.txt ./ | |
| # Install Python dependencies | |
| RUN pip3 install -r requirements.txt | |
| # Set environment variables for Streamlit | |
| ENV STREAMLIT_CONFIG_DIR=/app/.streamlit | |
| ENV STREAMLIT_SERVER_HEADLESS=true | |
| ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false | |
| # Expose port 8501 (Streamlit Spaces requirement) | |
| EXPOSE 8501 | |
| # Healthcheck endpoint for Spaces | |
| HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health | |
| # Run Streamlit (let it use default port 8501) | |
| ENTRYPOINT ["streamlit", "run", "main.py", "--server.address=0.0.0.0"] |