# Dockerfile (v2 - 已包含 antiword) # 1. 使用官方的 Python 3.9 映像檔作為基礎 FROM python:3.9-slim # --- 新增步驟:安裝 textract 所需的系統依賴 --- # apt-get update 更新軟體包列表 # apt-get install -y antiword 安裝 antiword,用於處理 .doc 檔案 # rm -rf /var/lib/apt/lists/* 清理緩存,保持映像檔小巧 RUN apt-get update && apt-get install -y antiword && rm -rf /var/lib/apt/lists/* # 2. 設定工作目錄 WORKDIR /app # 3. 複製依賴文件並安裝 Python 函式庫 COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # 4. 複製整個專案的程式碼到容器中 COPY . . # 5. 告訴 Docker 容器在運行時會監聽哪個端口 EXPOSE 7860 # 6. 啟動應用的命令 CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "7860"]