# 使用輕量級的 Python 3.10 作為基礎映像 FROM python:3.10-slim # 將工作目錄設定為 /code WORKDIR /code # 複製 requirements.txt 並安裝依賴套件 COPY ./requirements.txt /code/requirements.txt RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt # 複製你的應用程式程式碼 COPY ./app.py /code/app.py # 設定啟動指令:使用 gunicorn 啟動 app.py 中的 app 物件 # 綁定到 0.0.0.0:7860,這是 HF Spaces 預期的端口 CMD ["gunicorn", "--workers", "1", "--bind", "0.0.0.0:7860", "app:app"]