Spaces:
Sleeping
Sleeping
create Dockerfile
Browse files- Dockerfile +20 -0
Dockerfile
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Dockerfile (這是你的 Hugging Face Space 將使用的 Docker 配置)
|
2 |
+
|
3 |
+
# 使用 Python 3.9 的輕量級基礎映像
|
4 |
+
FROM python:3.9-slim-buster
|
5 |
+
|
6 |
+
# 設定工作目錄為 /app
|
7 |
+
WORKDIR /app
|
8 |
+
|
9 |
+
# 複製 requirements.txt 並安裝所有 Python 依賴
|
10 |
+
COPY requirements.txt .
|
11 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
12 |
+
|
13 |
+
# 複製所有應用程式檔案到容器中 (包括 app.py 和 best.pt)
|
14 |
+
COPY . .
|
15 |
+
|
16 |
+
# 暴露應用程式將運行的埠
|
17 |
+
EXPOSE 7860
|
18 |
+
|
19 |
+
# 定義容器啟動時執行的命令
|
20 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|