Spaces:
Sleeping
Sleeping
| # 使用 Python Slim 映像作為基礎 | |
| FROM python:3.11-slim | |
| # 安裝必要工具和依賴 | |
| RUN apt-get update && apt-get install -y wget unzip gnupg --no-install-recommends && \ | |
| wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \ | |
| dpkg -i google-chrome-stable_current_amd64.deb || apt-get -f install -y && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # 設置工作目錄 | |
| WORKDIR /app | |
| # 複製需求文件並安裝依賴 | |
| COPY requirements.txt requirements.txt | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # 複製應用代碼 | |
| COPY . . | |
| # 替換端口為 Hugging Face 規範的 7860 | |
| ENV PORT=7860 | |
| # 啟動應用 | |
| CMD ["gunicorn", "app:app", "--bind", "0.0.0.0:7860"] |