Spaces:
Running
Running
Claude
commited on
修复Dockerfile未复制静态资源目录的问题
Browse files问题:
- Hugging Face Spaces 部署时报错 "Directory 'static' does not exist"
- 原因:Dockerfile 只复制了 main.py,未复制 static 和 templates 目录
解决方案:
- 在 Dockerfile 中添加 COPY static/ ./static/
- 在 Dockerfile 中添加 COPY templates/ ./templates/
修复后将确保 Docker 容器包含完整的前端资源文件。
- Dockerfile +2 -0
Dockerfile
CHANGED
|
@@ -23,6 +23,8 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
| 23 |
# 5. 复制应用代码 (结构同您的 OCR-HFS)
|
| 24 |
COPY main.py .
|
| 25 |
COPY entrypoint.sh .
|
|
|
|
|
|
|
| 26 |
RUN chmod +x /app/entrypoint.sh
|
| 27 |
|
| 28 |
# 6. 创建临时工作目录 (结构同您的 OCR-HFS)
|
|
|
|
| 23 |
# 5. 复制应用代码 (结构同您的 OCR-HFS)
|
| 24 |
COPY main.py .
|
| 25 |
COPY entrypoint.sh .
|
| 26 |
+
COPY static/ ./static/
|
| 27 |
+
COPY templates/ ./templates/
|
| 28 |
RUN chmod +x /app/entrypoint.sh
|
| 29 |
|
| 30 |
# 6. 创建临时工作目录 (结构同您的 OCR-HFS)
|