Spaces:
Runtime error
Runtime error
# 1. Start from the official NVIDIA CUDA development image. This is the key change. | |
FROM nvidia/cuda:12.1.1-devel-ubuntu22.04 | |
# 2. Set up the environment to be non-interactive and add Python paths | |
ENV DEBIAN_FRONTEND=noninteractive | |
ENV PATH="/root/.local/bin:${PATH}" | |
# 3. Install Python 3.11, pip, and other essential tools | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
python3.11 \ | |
python3-pip \ | |
python-is-python3 \ | |
git \ | |
&& rm -rf /var/lib/apt/lists/* | |
# 4. Install uv for fast package installation | |
RUN pip install uv | |
# 5. Copy requirements and install them. | |
# The base image is clean, so we need to install everything, including torch. | |
COPY requirements.txt . | |
RUN uv pip install --no-cache --system -r requirements.txt | |
# 6. Copy the application code | |
COPY ./app.py /app/app.py | |
WORKDIR /app | |
# 7. Expose the port | |
EXPOSE 7860 | |
# 8. Run the application with uvicorn | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |