FROM python:3.12-slim WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ build-essential \ curl \ git \ && rm -rf /var/lib/apt/lists/* # Copy requirements first for better caching COPY requirements.txt . # Install CPU-only PyTorch first (avoids 2GB+ CUDA download) RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu RUN pip install --no-cache-dir -r requirements.txt # Copy application code COPY . . # Expose Streamlit (public HF port) and FastAPI (API port) EXPOSE 7860 8000 # Set environment variables ENV PYTHONUNBUFFERED=1 ENV STREAMLIT_SERVER_PORT=7860 ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0 # Run the application CMD ["python", "app.py"]