Skip to content

Commit 14b677b

Browse files
committed
项目重构(autorelease pls)
1 parent 3981c3c commit 14b677b

File tree

1 file changed

+27
-7
lines changed

1 file changed

+27
-7
lines changed

Dockerfile

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,38 @@
11
FROM python:3.9-slim
22

3+
# 设置工作目录
34
WORKDIR /app
45

5-
# 设置清华PyPI镜像源
6+
# 设置环境变量
7+
ENV PYTHONDONTWRITEBYTECODE=1 \
8+
PYTHONUNBUFFERED=1 \
9+
PORT=50721
10+
11+
# 安装依赖
612
COPY requirements.txt .
713
RUN 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"]

0 commit comments

Comments
 (0)