Update Dockerfile
Browse files- Dockerfile +15 -4
Dockerfile
CHANGED
|
@@ -1,12 +1,23 @@
|
|
| 1 |
FROM python:3.11
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
| 4 |
RUN git clone https://github.com/lanqian528/chat2api.git /app
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
RUN mkdir -p /app/data
|
| 7 |
RUN chmod -R 777 /app/data
|
|
|
|
|
|
|
| 8 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 9 |
|
|
|
|
| 10 |
EXPOSE 5005
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
| 1 |
FROM python:3.11
|
| 2 |
+
|
| 3 |
+
# 更新包列表并安装git和curl
|
| 4 |
+
RUN apt update && apt install -y git curl
|
| 5 |
+
|
| 6 |
+
# 克隆代码仓库
|
| 7 |
RUN git clone https://github.com/lanqian528/chat2api.git /app
|
| 8 |
+
|
| 9 |
+
# 设置工作目录
|
| 10 |
+
WORKDIR /app
|
| 11 |
+
|
| 12 |
+
# 创建数据目录并设置权限
|
| 13 |
RUN mkdir -p /app/data
|
| 14 |
RUN chmod -R 777 /app/data
|
| 15 |
+
|
| 16 |
+
# 安装Python依赖包
|
| 17 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 18 |
|
| 19 |
+
# 暴露端口5005
|
| 20 |
EXPOSE 5005
|
| 21 |
|
| 22 |
+
# 启动服务器并保持活跃
|
| 23 |
+
CMD ["sh", "-c", "python app.py --host 0.0.0.0 --port 5005 & while true; do curl -s http://localhost:5005 > /dev/null; sleep 1800; done"]
|