File size: 559 Bytes
1bba663
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 使用官方 Python 3.10 slim 映像
FROM python:3.10-slim

# 設定工作目錄
WORKDIR /app

# 安裝系統依賴
RUN apt-get update && \
    apt-get install -y git curl && \
    rm -rf /var/lib/apt/lists/*

# 複製 requirements.txt 並安裝 Python 套件
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# 複製專案檔案
COPY . .

# 建立快取資料夾並開放權限
RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache

# FastAPI 使用 uvicorn 啟動
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]