# 1. Use a modern Python slim image FROM python:3.10-slim # 2. Set the working directory WORKDIR /code # 3. Install the NEW OpenGL dependencies (Fixes the "no installation candidate" error) RUN apt-get update && apt-get install -y \ libgl1 \ libglx-mesa0 \ libglib2.0-0 \ && rm -rf /var/lib/apt/lists/* # 4. Copy requirements and install (No cache saves space) COPY ./requirements.txt /code/requirements.txt RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt # 5. Copy the rest of your application files COPY . . # 6. Set permissions for the MiDaS/Torch cache RUN mkdir -p /.cache && chmod 777 /.cache ENV TORCH_HOME=/.cache # 7. Start the server on the HF-required port CMD ["uvicorn", "main.py:app", "--host", "0.0.0.0", "--port", "7860"]