Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +37 -18
Dockerfile
CHANGED
@@ -1,24 +1,43 @@
|
|
1 |
-
# 使用适合的基础镜像,例如 python:3.9-slim
|
2 |
-
FROM python:3.9-slim
|
3 |
|
4 |
-
# 设置工作目录
|
5 |
-
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
-
#
|
8 |
-
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
-
#
|
24 |
-
CMD ["
|
|
|
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 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 |
+
# 安装 Flask (示例)
|
32 |
+
RUN pip install flask
|
33 |
+
|
34 |
+
# 复制应用代码
|
35 |
+
COPY app /app
|
36 |
+
|
37 |
+
WORKDIR /app
|
38 |
+
|
39 |
+
# 暴露端口
|
40 |
+
EXPOSE 8080
|
41 |
|
42 |
+
# 启动应用
|
43 |
+
CMD ["python", "app.py"]
|