File size: 707 Bytes
1929b56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 使用 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"]