Mahiruoshi commited on
Commit
34d6c3d
1 Parent(s): e8c034c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -4
Dockerfile CHANGED
@@ -7,8 +7,15 @@ WORKDIR /app
7
  # 将当前目录下的所有文件复制到容器中的工作目录
8
  COPY . /app
9
 
10
- # 使用pip安装依赖
11
- RUN pip install -r requirements.txt
 
12
 
13
- # 容器启动时执行 server.py
14
- CMD ["python", "server.py"]
 
 
 
 
 
 
 
7
  # 将当前目录下的所有文件复制到容器中的工作目录
8
  COPY . /app
9
 
10
+ # 创建一个名为 onnx 的新conda环境,指定Python版本为3.10,并激活环境
11
+ RUN conda create -n onnx python=3.10 -y && \
12
+ echo "source activate onnx" >> ~/.bashrc
13
 
14
+ # 添加清华源,安装requirements.txt中的所有依赖
15
+ ENV PATH /opt/conda/envs/onnx/bin:$PATH
16
+ RUN conda install -n onnx pip -y && \
17
+ pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && \
18
+ pip install -r requirements.txt
19
+
20
+ # 容器启动时在onnx环境中执行 server.py
21
+ CMD ["conda", "run", "-n", "onnx", "python", "server.py"]