# 使用官方 Python 基础镜像 FROM docker.io/library/python:3.10.13@sha256:d5b1fbbc00fd3b55620a9314222498bebf09c4bf606425bf464709ed6a79f202 # 更新并安装必要的软件包 RUN apt-get update && apt-get install -y \ git \ git-lfs \ ffmpeg \ libsm6 \ libxext6 \ cmake \ rsync \ libgl1-mesa-glx \ curl \ && rm -rf /var/lib/apt/lists/* \ && git lfs install # 安装 Rust 和 Cargo RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y ENV PATH="/root/.cargo/bin:${PATH}" # 安装 fakeroot 并设置 apt-get 使用 fakeroot RUN apt-get update && apt-get install -y fakeroot && \ mv /usr/bin/apt-get /usr/bin/.apt-get && \ echo '#!/usr/bin/env sh\nfakeroot /usr/bin/.apt-get $@' > /usr/bin/apt-get && \ chmod +x /usr/bin/apt-get && \ rm -rf /var/lib/apt/lists/* && \ useradd -m -u 1000 user # 复制文件并设置工作目录 COPY --chown=1000:1000 --from=root / / WORKDIR /home/user/app # 安装 Python 依赖包 RUN pip install --no-cache-dir pip==22.3.1 && \ pip install --no-cache-dir \ datasets \ "huggingface-hub>=0.19" \ "hf-transfer>=0.1.4" \ "protobuf<4" \ "click<8.1" \ "pydantic~=1.0" \ torch==2.3.1 # 安装其他 Python 依赖包 RUN pip install --no-cache-dir \ gradio[oauth]==4.36.1 \ "uvicorn>=0.14.0" \ spaces==0.29.2