FROM python:3.10-slim # Prevent Python from writing .pyc files ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 # Install system dependencies RUN apt-get update && apt-get install -y \ build-essential \ libglib2.0-0 \ libsm6 \ libxext6 \ libxrender-dev \ && rm -rf /var/lib/apt/lists/* # Set working directory WORKDIR /app # Copy requirements first (for caching) COPY requirements.txt . # Install Python dependencies (CPU only) RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir -r requirements.txt # Copy application files COPY app.py . COPY rice_leaf_model.pth . COPY README.md . # Expose Hugging Face required port EXPOSE 7860 # Start FastAPI CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]