# 固定带Python3.10、CUDA12.1的镜像,不再用latest FROM huggingface/transformers-pytorch-gpu:4.48.2-py310-cu121 # 编译flash-attn系统依赖 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc g++ build-essential ninja-build cuda-nvcc-12-1 \ && rm -rf /var/lib/apt/lists/* RUN pip install --upgrade pip setuptools wheel ninja COPY requirements.txt /tmp/requirements.txt RUN MAX_JOBS=2 pip install \ --no-cache-dir \ --no-binary flash-attn \ --no-build-isolation \ -r /tmp/requirements.txt \ gradio[oauth]==5.25.2 \ "uvicorn>=0.14.0" \ "websockets>=10.4" \ spaces CMD ["python", "app.py"]