FROM python:3.10-slim # Prevent python cache files ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 # HuggingFace model cache location ENV HF_HOME=/tmp/hf ENV TRANSFORMERS_CACHE=/tmp/hf ENV HF_HUB_DISABLE_TELEMETRY=1 WORKDIR /app # Install system dependencies needed for RDKit / scientific stack RUN apt-get update && apt-get install -y \ build-essential \ git \ && rm -rf /var/lib/apt/lists/* # Copy requirements first (improves Docker layer caching) COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir --upgrade pip \ && pip install --no-cache-dir -r requirements.txt # Copy application files COPY . . # HuggingFace Spaces uses port 7860 EXPOSE 7860 # --preload loads models once instead of per worker CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]