# Use an official Python runtime as a parent image FROM python:3.10-slim # Set the working directory in the container WORKDIR /app # Install necessary system dependencies (kept minimal) RUN apt-get update && \ apt-get install -y --no-install-recommends \ git \ libgl1 \ libglib2.0-0 \ && rm -rf /var/lib/apt/lists/* # Copy the requirements file first to leverage Docker cache COPY requirements.txt ./ # Install Python packages RUN pip install --no-cache-dir -r requirements.txt # Copy the entire project COPY . /app/ # Create a non-root user (HF Spaces requirement) RUN useradd -m -u 1000 user USER user # Make sure the user owns the app directory COPY --chown=user:user . /app/ # Expose Gradio default port EXPOSE 7860 ENV PYTHONUNBUFFERED=1 # Run the app from the src/IDH directory CMD ["python", "src/IDH/app_gradio.py"]