@@ -8,8 +8,8 @@ WORKDIR /workspace
88ENV CUDA_HOME=/usr/local/cuda
99
1010# 安装依赖
11- RUN apt update -y && apt install -y apt-utils && apt upgrade -y
12- RUN apt install -y --no-install-recommends \
11+ RUN apt update -y && apt install -y apt-utils && apt upgrade -y && apt-get clean && rm -rf /var/lib/apt/lists/*
12+ RUN apt update -y && apt install -y --no-install-recommends \
1313 libtbb-dev \
1414 libssl-dev \
1515 libcurl4-openssl-dev \
@@ -23,29 +23,21 @@ RUN apt install -y --no-install-recommends \
2323 wget \
2424 vim \
2525 gcc \
26- g++
26+ g++ && apt-get clean && rm -rf /var/lib/apt/lists/*
2727
2828# 安装CMake
2929RUN wget https://github.com/Kitware/CMake/releases/download/v4.0.1/cmake-4.0.1-linux-x86_64.sh && echo y | bash cmake-4.0.1-linux-x86_64.sh && rm -rf cmake-4.0.1-linux-x86_64.sh
3030
3131# 克隆代码
3232RUN git clone https://github.com/kvcache-ai/ktransformers.git
33- # 清理 apt 缓存
34- RUN rm -rf /var/lib/apt/lists/*
3533
3634# 进入项目目录
3735WORKDIR /workspace/ktransformers
3836# 初始化子模块
3937RUN git submodule update --init --recursive
4038
4139# 升级 pip
42- RUN pip install --upgrade pip && pip install -U wheel setuptools
43-
44- # 安装构建依赖
45- RUN pip install ninja pyproject numpy cpufeature aiohttp zmq openai
46-
47- # 安装 flash-attn(提前装可以避免后续某些编译依赖出错)
48- RUN pip install flash-attn
40+ RUN pip install --upgrade pip && pip install -U wheel setuptools ninja pyproject numpy cpufeature aiohttp zmq openai flash-attn && pip cache purge
4941
5042# 安装 ktransformers 本体(含编译)
5143RUN CPU_INSTRUCT=${CPU_INSTRUCT} \
@@ -54,18 +46,16 @@ RUN CPU_INSTRUCT=${CPU_INSTRUCT} \
5446 TORCH_CUDA_ARCH_LIST="8.0;8.6;8.7;8.9;9.0+PTX" \
5547 pip install . --no-build-isolation --verbose
5648
57- RUN pip install third_party/custom_flashinfer/
58- # 清理 pip 缓存
59- RUN pip cache purge
49+ RUN pip install third_party/custom_flashinfer/ && pip cache purge
6050
6151# 拷贝 C++ 运行时库
6252RUN cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /opt/conda/lib/
6353
6454# 预下载的配置文件
65- RUN pip install huggingface_hub modelscope
66- RUN huggingface-cli download deepseek-ai/DeepSeek-R1 --exclude *.safetensors --local-dir /app/model/DeepSeek-R1
67- RUN huggingface-cli download deepseek-ai/DeepSeek-V3-0324 --exclude *.safetensors --local-dir /app/model/DeepSeek-V3-0324
68- RUN huggingface-cli download deepseek-ai/DeepSeek-V2-Lite-Chat --exclude *.safetensors --local-dir /app/model/DeepSeek-V2-Lite-Chat
55+ # RUN pip install huggingface_hub modelscope
56+ # RUN huggingface-cli download deepseek-ai/DeepSeek-R1 --exclude *.safetensors --local-dir /app/model/DeepSeek-R1
57+ # RUN huggingface-cli download deepseek-ai/DeepSeek-V3-0324 --exclude *.safetensors --local-dir /app/model/DeepSeek-V3-0324
58+ # RUN huggingface-cli download deepseek-ai/DeepSeek-V2-Lite-Chat --exclude *.safetensors --local-dir /app/model/DeepSeek-V2-Lite-Chat
6959
7060# 保持容器运行(调试用)
7161ENTRYPOINT ["tail" , "-f" , "/dev/null" ]
0 commit comments