# Use the official Python 3.10.9 image FROM ubuntu WORKDIR /usr/src/app # RUN add-apt-repository main RUN apt-get update # RUN apt-get install -y libgl1-mesa-glx RUN apt install -y python3-pip RUN rm /usr/lib/python3.*/EXTERNALLY-MANAGED COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY . . ENV HF_HOME=/tmp ENV TRANSFORMERS_CACHE=/tmp RUN chown -R : /usr/src/app/ # Start the FastAPI app on port 7860, the default port expected by Spaces CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]