hf-demo-linux commited on
Commit
ed5b1fa
·
verified ·
1 Parent(s): d16010a

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +23 -0
Dockerfile ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 使用官方 Python 运行时作为父镜像
2
+ FROM python:3.12-rc-slim-buster
3
+
4
+ # 设置工作目录为 /app
5
+ WORKDIR /app
6
+
7
+ # 将当前目录下的 requirements.txt 复制到容器的 /app/requirements.txt 中
8
+ COPY requirements.txt /app/
9
+
10
+ # 安装 requirements.txt 中指定的任何所需软件包
11
+ RUN pip install --no-cache-dir -r requirements.txt
12
+
13
+ # 将当前目录下的其余文件复制到容器的 /app 中
14
+ COPY . /app/
15
+
16
+ # 使端口 7860 可供此容器外的世界使用
17
+ EXPOSE 7860
18
+
19
+ # 设置环境变量 PORT,以适应 Hugging Face Space 的要求
20
+ ENV PORT=7860
21
+
22
+ # 在容器启动时运行 app.py
23
+ CMD ["python", "app.py"]