FROM python:3.10-slim # 設置工作目錄 WORKDIR /app # 複製依賴文件 COPY requirements.txt . # 安裝依賴 RUN pip install --no-cache-dir -r requirements.txt # 複製整個專案 COPY . . # 暴露端口(Hugging Face 會自動注入 $PORT) EXPOSE 7860 # 使用 Hugging Face 的 $PORT 變數啟動 Uvicorn CMD ["uvicorn", "api_server:app", "--host", "0.0.0.0", "--port", "7860"]