Spaces:
Sleeping
Sleeping
tianlong12
commited on
Commit
•
c61a34f
1
Parent(s):
646f32b
Create Dockerfile
Browse files- Dockerfile +24 -0
Dockerfile
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# 使用官方Python运行时作为父镜像
|
2 |
+
FROM python:3.9-slim
|
3 |
+
|
4 |
+
# 设置工作目录
|
5 |
+
WORKDIR /app
|
6 |
+
|
7 |
+
# 复制 requirements.txt 文件
|
8 |
+
COPY requirements.txt .
|
9 |
+
|
10 |
+
# 安装项目依赖
|
11 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
12 |
+
|
13 |
+
# 将当前目录内容复制到容器的/app目录
|
14 |
+
COPY . .
|
15 |
+
|
16 |
+
# 设置环境变量
|
17 |
+
ENV FLASK_APP=app.py
|
18 |
+
ENV FLASK_RUN_HOST=0.0.0.0
|
19 |
+
|
20 |
+
# 暴露端口7860,这是Hugging Face Spaces使用的默认端口
|
21 |
+
EXPOSE 7860
|
22 |
+
|
23 |
+
# 运行Flask应用
|
24 |
+
CMD ["flask", "run", "--port=7860"]
|