milk-git55 commited on
Commit
10a0607
·
verified ·
1 Parent(s): a158854

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +24 -22
Dockerfile CHANGED
@@ -1,22 +1,24 @@
1
- # 使用 Python 3.10 轻量级镜像
2
- FROM python:3.10-slim
3
-
4
- # 设置工作目录
5
- WORKDIR /app
6
-
7
- # 设置环境变量
8
- ENV PYTHONUNBUFFERED=1
9
-
10
- # 复制依赖文件并安装
11
- COPY requirements.txt .
12
- RUN pip install --no-cache-dir -r requirements.txt
13
-
14
- # 复制应用代码到容器中
15
- COPY . .
16
-
17
- # Hugging Face Spaces 默认使 7860 端口
18
- EXPOSE 7860
19
-
20
- # 启动命令
21
- # 注意:这里必须是 uvicorn music_api:app,对应您的文件名 music_api.py
22
- CMD ["uvicorn", "music_api:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
1
+ # 使用 Python 基础镜像
2
+ FROM python:3.10-slim
3
+
4
+ # 设置工作目录
5
+ WORKDIR /app
6
+
7
+ # 安装系统依赖
8
+ RUN apt-get update && apt-get install -y \
9
+ git \
10
+ git-lfs \
11
+ && rm -rf /var/lib/apt/lists/*
12
+
13
+ # 安装 Python 依赖
14
+ COPY requirements.txt .
15
+ RUN pip install --no-cache-dir -r requirements.txt
16
+
17
+ # 复制应代码
18
+ COPY music_api.py .
19
+
20
+ # 暴露端口
21
+ EXPOSE 7860
22
+
23
+ # 启动命令
24
+ CMD ["uvicorn", "music_api:app", "--host", "0.0.0.0", "--port", "7860"]