Spaces:
houin
/
Sleeping

IPGEO commited on
Commit
46cf80a
·
verified ·
1 Parent(s): 6a2d461

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +31 -0
Dockerfile ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9 as py-builder
2
+ WORKDIR /code
3
+
4
+ # 拷贝依赖文件并安装依赖
5
+ COPY ./requirements.txt .
6
+ RUN pip install --no-cache-dir -r requirements.txt
7
+
8
+ FROM python:3.9-slim
9
+ ENV TZ=Asia/Shanghai
10
+ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
11
+
12
+ # 安装必要的系统依赖
13
+ RUN apt-get update && apt-get install -y curl procps && rm -rf /var/lib/apt/lists/*
14
+
15
+ WORKDIR /code
16
+
17
+ # 拷贝依赖和应用代码
18
+ COPY --from=py-builder /usr/local/lib/python3.9/site-packages /usr/local/lib/python3.9/site-packages
19
+ COPY --from=py-builder /usr/local/bin /usr/local/bin
20
+
21
+ COPY ./main.py .
22
+ COPY ./update_and_restart.sh .
23
+
24
+ # 设置所有文件和目录的权限为 777
25
+ RUN chmod -R 777 /code
26
+
27
+ # 确保启动脚本可执行
28
+ RUN chmod +x /code/update_and_restart.sh
29
+
30
+ # 容器启动命令
31
+ CMD ["sh", "/code/update_and_restart.sh"]