Update Dockerfile
Browse files- Dockerfile +6 -1
Dockerfile
CHANGED
|
@@ -16,6 +16,11 @@ RUN apt-get update && apt-get install -y \
|
|
| 16 |
|
| 17 |
# 创建 python 的符号链接
|
| 18 |
RUN ln -s /usr/bin/python3.11 /usr/bin/python
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
# # 创建非特权用户
|
| 21 |
RUN useradd -m -s /bin/bash appuser
|
|
@@ -36,4 +41,4 @@ RUN pip install --no-cache-dir --ignore-installed -r requirements.txt
|
|
| 36 |
USER appuser
|
| 37 |
|
| 38 |
# 设置默认命令(可根据需要修改)
|
| 39 |
-
CMD ["python3.11", "main.py"]
|
|
|
|
| 16 |
|
| 17 |
# 创建 python 的符号链接
|
| 18 |
RUN ln -s /usr/bin/python3.11 /usr/bin/python
|
| 19 |
+
# 创建虚拟环境并安装 pip
|
| 20 |
+
RUN python3.11 -m venv /venv
|
| 21 |
+
|
| 22 |
+
# 激活虚拟环境并安装 requirements.txt 中的包
|
| 23 |
+
RUN /venv/bin/pip install --no-cache-dir -r requirements.txt
|
| 24 |
|
| 25 |
# # 创建非特权用户
|
| 26 |
RUN useradd -m -s /bin/bash appuser
|
|
|
|
| 41 |
USER appuser
|
| 42 |
|
| 43 |
# 设置默认命令(可根据需要修改)
|
| 44 |
+
CMD ["/venv/bin/python3.11", "main.py"]
|