Create Dockerfile
Browse files- Dockerfile +20 -0
Dockerfile
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 使用 Hugging Face 提供的 CPU 基础镜像(Python 3.10)
|
| 2 |
+
FROM huggingface/space-python3.10-cpu
|
| 3 |
+
|
| 4 |
+
# 安装系统依赖(ffmpeg 用于视频编解码)
|
| 5 |
+
RUN apt-get update && \
|
| 6 |
+
apt-get install -y --no-install-recommends ffmpeg && \
|
| 7 |
+
rm -rf /var/lib/apt/lists/*
|
| 8 |
+
|
| 9 |
+
# 初始化 Git 子模块(关键!原项目用了 --recursive 克隆)
|
| 10 |
+
RUN git submodule init && \
|
| 11 |
+
git submodule update
|
| 12 |
+
|
| 13 |
+
# 复制项目代码到容器(/app 是 Hugging Face Space 的默认工作目录)
|
| 14 |
+
COPY . /app
|
| 15 |
+
|
| 16 |
+
# 安装 Python 依赖(使用 requirements.txt,--no-cache 避免缓存)
|
| 17 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 18 |
+
|
| 19 |
+
# 启动命令(运行 Gradio 应用,端口固定为 7860)
|
| 20 |
+
CMD ["python", "app.py"]
|