FROM python:3.10-slim WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ git \ libgomp1 \ && rm -rf /var/lib/apt/lists/* # Copy requirements and install Python packages COPY requirements.txt . # Install dependencies (prefer binaries to avoid builds) RUN pip install --no-cache-dir --upgrade pip setuptools wheel # Install torch from CPU wheels explicitly to avoid source builds RUN pip install --no-cache-dir --prefer-binary \ torch==2.2.2 \ --index-url https://download.pytorch.org/whl/cpu \ --extra-index-url https://pypi.org/simple RUN pip install --no-cache-dir --prefer-binary -r requirements.txt # Copy application code COPY . . # Expose port 7860 (Gradio default) EXPOSE 7860 # Runtime env (logging + Gradio bind) ENV PYTHONUNBUFFERED=1 \ GRADIO_SERVER_NAME="0.0.0.0" # Run the app CMD ["python", "-u", "app.py"]