wixcs commited on
Commit
0d644cd
·
verified ·
1 Parent(s): 5a751ae

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +4 -25
Dockerfile CHANGED
@@ -17,31 +17,10 @@
17
  #CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
18
  # 使用官方 Nginx 基础镜像
19
  # 使用官方 Python 运行时作为父镜像
20
- FROM python:3.8-slim
21
-
22
- # 设置工作目录
23
- WORKDIR /app
24
-
25
- # 将 requirements.txt 复制到工作目录
26
- COPY requirements.txt ./
27
-
28
- # 安装 Python 依赖
29
- RUN pip install --no-cache-dir -r requirements.txt
30
-
31
- # 将项目文件复制到工作目录
32
- COPY . .
33
-
34
- # 安装 Nginx
35
- RUN apt-get update && apt-get install -y nginx
36
-
37
- # 配置 Nginx
38
  COPY nginx.conf /etc/nginx/nginx.conf
39
-
40
- # 暴露端口
41
- EXPOSE 80
42
-
43
- # 运行 Nginx 和你的应用程序
44
- CMD ["sh", "-c", "nginx && gunicorn -b:7860 app:app"]
45
-
46
 
47
 
 
17
  #CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
18
  # 使用官方 Nginx 基础镜像
19
  # 使用官方 Python 运行时作为父镜像
20
+ FROM nginx:alpine
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  COPY nginx.conf /etc/nginx/nginx.conf
22
+ COPY . /usr/share/nginx/html
23
+ RUN chown -R nginx:nginx /usr/share/nginx/html
24
+ USER nginx
 
 
 
 
25
 
26