cwadayi commited on
Commit
d5d1d70
·
verified ·
1 Parent(s): f545b2f

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -13
Dockerfile CHANGED
@@ -1,17 +1,16 @@
1
- # Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
- # you will also find guides on how best to write your Dockerfile
3
 
4
- FROM python:3.9
 
5
 
6
- RUN useradd -m -u 1000 user
7
- USER user
8
- ENV PATH="/home/user/.local/bin:$PATH"
9
 
10
- WORKDIR /app
11
-
12
- COPY --chown=user ./requirements.txt requirements.txt
13
- RUN pip install --no-cache-dir --upgrade -r requirements.txt
14
-
15
- COPY --chown=user . /app
16
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
17
 
 
 
 
 
1
+ # 使用輕量級的 Python 3.10 作為基礎映像
2
+ FROM python:3.10-slim
3
 
4
+ # 將工作目錄設定為 /code
5
+ WORKDIR /code
6
 
7
+ # 複製 requirements.txt 並安裝依賴套件
8
+ COPY ./requirements.txt /code/requirements.txt
9
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
10
 
11
+ # 複製你的應用程式程式碼
12
+ COPY ./app.py /code/app.py
 
 
 
 
 
13
 
14
+ # 設定啟動指令:使用 gunicorn 啟動 app.py 中的 app 物件
15
+ # 綁定到 0.0.0.0:7860,這是 HF Spaces 預期的端口
16
+ CMD ["gunicorn", "--workers", "1", "--bind", "0.0.0.0:7860", "app:app"]