File size: 1,453 Bytes
994ee1b
 
 
 
 
 
16214af
af9b4db
2525b99
994ee1b
 
 
 
fa37112
994ee1b
 
fa37112
994ee1b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
abbf662
256524e
994ee1b
5527b0e
e07e8d3
 
5527b0e
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
# 使用官方的Python运行时作为父镜像
FROM python:3.10-slim

# 设置工作目录
WORKDIR /app

# 更新系统包并安装wget
RUN apt-get update && apt-get install -y git wget && rm -rf /var/lib/apt/lists/*

# 安装 Conda
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh \
    && bash miniconda.sh -b -p /opt/conda \
    && rm miniconda.sh \
    && /opt/conda/bin/conda update conda -y

# 将 Conda 添加到 PATH
ENV PATH="/opt/conda/bin:${PATH}"

# 创建 Conda 环境
RUN conda create -n lagent python=3.10 -y

# 激活 Conda 环境
SHELL ["conda", "run", "-n", "lagent", "/bin/bash", "-c"]

# 安装 PyTorch 和其他依赖项
RUN conda install pytorch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 pytorch-cuda=12.1 -c pytorch -c nvidia -y
RUN pip install termcolor==2.4.0 streamlit==1.39.0 class_registry==2.1.2 datasets==3.1.0

# 克隆代码仓库
RUN git clone https://github.com/InternLM/lagent.git
WORKDIR /app/lagent
RUN git checkout e304e5d
RUN pip install -e .
WORKDIR /app

# 安装 griffe
RUN pip install griffe==0.48.0

# 拷贝应用代码到工作目录
COPY . /app

# 暴露端口
EXPOSE 8501

RUN which streamlit

# 运行命令
ENV PATH="/opt/conda/envs/lagent/bin:$PATH"
CMD ["streamlit", "run", "app.py", "--server.address", "0.0.0.0", "--server.port", "8501"]
# CMD ["streamlit", "run", "app.py"]
# CMD ["/bin/bash", "-c", "conda activate lagent && streamlit run app.py"]