isididiidid commited on
Commit
a2e1adc
·
verified ·
1 Parent(s): e06f2ac

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +4 -9
Dockerfile CHANGED
@@ -1,4 +1,3 @@
1
- # 使用更稳定的基础镜像
2
  FROM python:3.9-slim-bullseye
3
 
4
  # 安装系统依赖
@@ -16,22 +15,18 @@ COPY app.py requirements.txt ./
16
 
17
  # 安装Python依赖
18
  RUN pip install --no-cache-dir -r requirements.txt && \
19
- pip install gunicorn==20.1.0 # 固定版本保证稳定性
20
 
21
  # 设置环境变量
22
  ENV PORT=7860 \
23
- FLASK_ENV=production \
24
- FLASK_APP=app.py
25
 
26
  # 暴露指定端口
27
  EXPOSE 7860
28
 
29
- # 正确创建非root户并设置权限
30
- RUN useradd -m appuser && chown appuser:appuser /app
31
- USER appuser
32
 
33
- # 启动命令
34
- CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "2", "app:app"]
35
 
36
 
37
 
 
 
1
  FROM python:3.9-slim-bullseye
2
 
3
  # 安装系统依赖
 
15
 
16
  # 安装Python依赖
17
  RUN pip install --no-cache-dir -r requirements.txt && \
18
+ pip install gunicorn==20.1.0
19
 
20
  # 设置环境变量
21
  ENV PORT=7860 \
22
+ FLASK_ENV=production
 
23
 
24
  # 暴露指定端口
25
  EXPOSE 7860
26
 
27
+ # 启动命令 - 直接使Flask运行而非Gunicorn
28
+ CMD ["python", "app.py"]
 
29
 
 
 
30
 
31
 
32