Skip to content

Commit 7fd8644

Browse files
authored
Update Dockerfile-web
1 parent 4157119 commit 7fd8644

File tree

1 file changed

+43
-12
lines changed

1 file changed

+43
-12
lines changed

Dockerfile-web

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,53 @@ ENV DEBIAN_FRONTEND=noninteractive
99
WORKDIR /workspace
1010
ENV CUDA_HOME=/usr/local/cuda
1111

12-
# 配置WEB所需环境
13-
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /usr/share/keyrings/nodesource.gpg
14-
RUN chmod 644 /usr/share/keyrings/nodesource.gpg
15-
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_23.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
16-
1712
# 安装依赖
18-
RUN apt update -y && apt install -y apt-utils && apt upgrade && apt install -y --no-install-recommends net-tools tree vim curl git git-lfs neofetch libtbb-dev libssl-dev libcurl4-openssl-dev libaio1 libaio-dev libfmt-dev libgflags-dev zlib1g-dev patchelf git wget vim gcc g++ apt-transport-https ca-certificates curl gnupg nodejs && apt-get clean && rm -rf /var/lib/apt/lists/*
13+
RUN apt update -y && apt install -y apt-utils && apt upgrade -y
14+
RUN apt install -y --no-install-recommends \
15+
libtbb-dev \
16+
libssl-dev \
17+
libcurl4-openssl-dev \
18+
libaio1 \
19+
libaio-dev \
20+
libfmt-dev \
21+
libgflags-dev \
22+
zlib1g-dev \
23+
patchelf \
24+
git \
25+
wget \
26+
vim \
27+
gcc \
28+
g++
1929

2030
# 安装CMake
2131
RUN 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
2232

2333
# 克隆代码
2434
RUN git clone https://github.com/kvcache-ai/ktransformers.git
35+
# 清理 apt 缓存
36+
RUN rm -rf /var/lib/apt/lists/*
37+
2538
# 进入项目目录
2639
WORKDIR /workspace/ktransformers
2740
# 初始化子模块
2841
RUN git submodule update --init --recursive
2942

3043
# 升级 pip
31-
RUN pip install --upgrade pip && pip install -U wheel setuptools ninja pyproject numpy cpufeature aiohttp zmq openai flash-attn && pip cache purge
44+
RUN pip install --upgrade pip && pip install -U wheel setuptools
45+
46+
# 安装构建依赖
47+
RUN pip install ninja pyproject numpy cpufeature aiohttp zmq openai
48+
49+
# 安装 flash-attn(提前装可以避免后续某些编译依赖出错)
50+
RUN pip install flash-attn
51+
52+
# 安装WEB所需环境
53+
RUN apt-get update -y && apt-get install -y apt-transport-https ca-certificates curl gnupg
54+
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /usr/share/keyrings/nodesource.gpg
55+
RUN chmod 644 /usr/share/keyrings/nodesource.gpg
56+
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_23.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
57+
RUN apt-get update -y
58+
RUN apt-get install nodejs -y
3259

3360
# 安装 WEB
3461
RUN cd /workspace/ktransformers/ktransformers/website/public && rm -rf config.js && wget https://github.com/IAMJOYBO/ktransformers/raw/refs/heads/main/config.js
@@ -41,20 +68,24 @@ RUN CPU_INSTRUCT=${CPU_INSTRUCT} \
4168
TORCH_CUDA_ARCH_LIST="8.0;8.6;8.7;8.9;9.0+PTX" \
4269
pip install . --no-build-isolation --verbose
4370

44-
RUN pip install third_party/custom_flashinfer/ && pip cache purge
71+
RUN pip install third_party/custom_flashinfer/
72+
# 清理 pip 缓存
73+
RUN pip cache purge
4574

4675
# 拷贝 C++ 运行时库
4776
RUN cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /opt/conda/lib/
4877

78+
# 安装部分个人使用的工具
79+
RUN apt install -y net-tools tree vim curl git git-lfs neofetch
4980
# apt修改为国内源
5081
RUN rm -rf /etc/apt/sources.list && wget https://github.com/IAMJOYBO/ktransformers/raw/refs/heads/main/sources-20.04.list -O /etc/apt/sources.list
5182
RUN pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
5283

5384
# 预下载的配置文件
54-
# RUN pip install huggingface_hub modelscope
55-
# RUN huggingface-cli download deepseek-ai/DeepSeek-R1 --exclude *.safetensors --local-dir /app/model/DeepSeek-R1
56-
# RUN huggingface-cli download deepseek-ai/DeepSeek-V3-0324 --exclude *.safetensors --local-dir /app/model/DeepSeek-V3-0324
57-
# RUN huggingface-cli download deepseek-ai/DeepSeek-V2-Lite-Chat --exclude *.safetensors --local-dir /app/model/DeepSeek-V2-Lite-Chat
85+
RUN pip install huggingface_hub modelscope
86+
RUN huggingface-cli download deepseek-ai/DeepSeek-R1 --exclude *.safetensors --local-dir /app/model/DeepSeek-R1
87+
RUN huggingface-cli download deepseek-ai/DeepSeek-V3-0324 --exclude *.safetensors --local-dir /app/model/DeepSeek-V3-0324
88+
RUN huggingface-cli download deepseek-ai/DeepSeek-V2-Lite-Chat --exclude *.safetensors --local-dir /app/model/DeepSeek-V2-Lite-Chat
5889

5990
# 保持容器运行(调试用)
6091
ENTRYPOINT ["tail", "-f", "/dev/null"]

0 commit comments

Comments
 (0)