File tree Expand file tree Collapse file tree 1 file changed +27
-7
lines changed
Expand file tree Collapse file tree 1 file changed +27
-7
lines changed Original file line number Diff line number Diff line change 11FROM python:3.9-slim
22
3+ # 设置工作目录
34WORKDIR /app
45
5- # 设置清华PyPI镜像源
6+ # 设置环境变量
7+ ENV PYTHONDONTWRITEBYTECODE=1 \
8+ PYTHONUNBUFFERED=1 \
9+ PORT=50721
10+
11+ # 安装依赖
612COPY requirements.txt .
713RUN pip install --no-cache-dir -r requirements.txt \
814 -i https://pypi.tuna.tsinghua.edu.cn/simple \
915 --trusted-host pypi.tuna.tsinghua.edu.cn
10-
11- COPY app.py .
12- COPY static ./static
13- COPY html ./html
1416
17+ # 复制应用代码
18+ COPY run.py .
19+ COPY app/ ./app/
20+
21+ # 创建必要的目录
22+ RUN mkdir -p images logs static
23+
24+ # 复制静态文件
25+ COPY static/ ./static/
26+
27+ # 设置权限
28+ RUN chmod -R 755 /app
29+
30+ # 暴露端口
31+ EXPOSE ${PORT}
1532
16- EXPOSE 50721
33+ # 健康检查
34+ HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
35+ CMD curl -f http://localhost:${PORT}/ || exit 1
1736
18- CMD ["python" ,"-u" ,"app.py" ]
37+ # 设置容器启动命令
38+ CMD ["python" , "-u" , "run.py" ]
You can’t perform that action at this time.
0 commit comments