# Use a base image that includes CUDA 11.7 and the CUDA toolkit FROM nvidia/cuda:11.7.1-cudnn8-devel-ubuntu22.04 RUN apt-get update && apt-get upgrade -y RUN apt-get install -y wget RUN apt-get install -y python3-pip python3-dev RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y RUN apt-get install -y git RUN pip3 install --upgrade pip RUN pip3 install packaging RUN pip install --no-cache-dir numpy==1.23.5 RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:$PATH" WORKDIR /app COPY --chown=user ./requirements.txt requirements.txt # Install torch first # RUN pip install --no-cache-dir torch==2.0.1+cu117 # Now install the rest of the packages RUN pip install --no-cache-dir --upgrade -r requirements.txt # RUN pip install flash_attn COPY --chown=user . /app CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]