-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
60 lines (50 loc) · 2.25 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# 配置基础镜像
FROM nvidia/cuda:12.1.0-cudnn8-devel-ubuntu22.04
# 设置工作目录
WORKDIR /tmp
USER root
# 安装依赖
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
ENV TZ=Asia/Shanghai
RUN set -ex \
&& ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
&& apt-get update && apt-get install -y openssh-server \
git vim tzdata curl net-tools locales zip libtinfo5 cmake \
exuberant-ctags libclang-dev tcl expect telnet rsync \
&& rm -rf /var/lib/apt/lists/* \
&& sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config \
&& service ssh start \
&& echo 'LANG="en_US.UTF-8"' > /etc/default/locale \
&& echo 'LC_ALL="en_US.UTF-8"' >> /etc/default/locale \
&& locale-gen en_US.UTF-8
# 下载并安装 Miniconda
RUN set -ex \
&& wget https://repo.anaconda.com/miniconda/Miniconda3-py310_23.1.0-1-Linux-x86_64.sh \
&& bash Miniconda3-py310_23.1.0-1-Linux-x86_64.sh -b -p /opt/miniconda3 \
&& rm Miniconda3-py310_23.1.0-1-Linux-x86_64.sh \
&& wget https://packages.redis.io/redis-stack/redis-stack-server-7.2.0-v10.rhel7.x86_64.tar.gz \
&& tar xf redis-stack-server-7.2.0-v10.rhel7.x86_64.tar.gz \
&& chown -R root:root /tmp && chmod 1777 /tmp \
&& mv redis-stack-server-7.2.0-v10 /usr/local/ \
&& rm -rf redis-stack-server-7.2.0-v10.rhel7.x86_64.tar.gz
# 将 conda 的 bin 目录添加到 PATH 环境变量
ENV PATH="/opt/miniconda3/bin:/usr/local/redis-stack-server-7.2.0-v10/bin:${PATH}"
# 复制 requirements.txt 文件到 Docker 容器
COPY requirement* /tmp/
# 初始化 conda
RUN conda init bash \
&& conda create -n lazyllm --clone base \
&& echo "source activate lazyllm" > ~/.bashrc
# 拆分多个requirements安装
RUN --mount=type=cache,target=/root/.cache/pip,uid=0,gid=0 \
bash -c "source activate lazyllm && \
conda install -y mpi4py && \
pip install -r requirements0.txt --default-timeout=10000 --no-deps && \
pip install -r requirements1.txt --default-timeout=10000 --no-deps && \
pip install -r requirements2.txt --default-timeout=10000 --no-deps && \
pip install -r requirements3.txt --default-timeout=10000 --no-deps && \
pip install flash-attn==2.6.2 && \
rm -rf /tmp/*"
ENTRYPOINT ["/bin/bash"]
WORKDIR /root