Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +18 -36
Dockerfile
CHANGED
@@ -1,44 +1,26 @@
|
|
1 |
-
#
|
2 |
-
# FROM python:3.9-slim
|
3 |
-
|
4 |
-
# # 设置工作目录
|
5 |
-
# WORKDIR /app
|
6 |
-
|
7 |
-
# # 复制项目文件
|
8 |
-
# COPY . /app
|
9 |
-
# COPY ./data /app/data
|
10 |
-
# COPY ./static /app/static
|
11 |
-
# COPY ./results /app/results
|
12 |
-
# COPY ./templates /app/templates
|
13 |
-
|
14 |
-
# # 安装依赖
|
15 |
-
# RUN pip install -r requirements.txt
|
16 |
-
|
17 |
-
# # 暴露应用运行的端口
|
18 |
-
# EXPOSE 7860
|
19 |
-
|
20 |
-
# # 设置环境变量
|
21 |
-
# ENV FLASK_APP=app.py
|
22 |
-
|
23 |
-
# # 运行 Flask 应用
|
24 |
-
# CMD ["flask", "run", "--host=0.0.0.0", "--port=7860"]
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
# 基础镜像
|
29 |
FROM python:3.9-slim
|
30 |
|
31 |
-
#
|
32 |
-
RUN pip install flask
|
33 |
-
|
34 |
WORKDIR /app
|
35 |
-
# 复制应用代码
|
36 |
-
COPY app /app
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
|
|
|
|
39 |
|
40 |
-
#
|
41 |
EXPOSE 8080
|
42 |
|
43 |
-
#
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# 使用适合的基础镜像,例如 python:3.9-slim
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
FROM python:3.9-slim
|
3 |
|
4 |
+
# 设置工作目录
|
|
|
|
|
5 |
WORKDIR /app
|
|
|
|
|
6 |
|
7 |
+
# 复制项目文件
|
8 |
+
COPY . /app
|
9 |
+
COPY ./data /app/data
|
10 |
+
COPY ./static /app/static
|
11 |
+
COPY ./results /app/results
|
12 |
+
COPY ./templates /app/templates
|
13 |
|
14 |
+
# 安装依赖
|
15 |
+
RUN pip install -r requirements.txt
|
16 |
|
17 |
+
# 暴露应用运行的端口
|
18 |
EXPOSE 8080
|
19 |
|
20 |
+
# 设置环境变量
|
21 |
+
ENV FLASK_APP=app.py
|
22 |
+
|
23 |
+
# 运行 Flask 应用
|
24 |
+
CMD ["flask", "run", "--host=0.0.0.0", "--port=8080"]
|
25 |
+
|
26 |
+
|