FROM tensorflow/tensorflow:2.15.0-gpu WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ libgl1-mesa-glx \ libglib2.0-0 \ && rm -rf /var/lib/apt/lists/* # Copy requirements and install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application code COPY app.py . # Copy model files (you'll need to add these) COPY model18cls/ ./model18cls/ # Create non-root user for HF Spaces RUN useradd -m -u 1000 user USER user # Set environment variables ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH \ PYTHONUNBUFFERED=1 EXPOSE 7860 CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]