41 lines
800 B
Docker
41 lines
800 B
Docker
FROM python:3.11-slim
|
||
|
||
WORKDIR /app
|
||
|
||
# 安装系统依赖(Playwright需要)
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||
curl \
|
||
wget \
|
||
gnupg \
|
||
libglib2.0-0 \
|
||
libnss3 \
|
||
libnspr4 \
|
||
libatk1.0-0 \
|
||
libatk-bridge2.0-0 \
|
||
libcups2 \
|
||
libdrm2 \
|
||
libxkbcommon0 \
|
||
libxcomposite1 \
|
||
libxdamage1 \
|
||
libxrandr2 \
|
||
libgbm1 \
|
||
libpango-1.0-0 \
|
||
libcairo2 \
|
||
libasound2 \
|
||
&& rm -rf /var/lib/apt/lists/*
|
||
|
||
# 复制并安装Python依赖
|
||
COPY requirements.txt .
|
||
RUN pip install --no-cache-dir -r requirements.txt
|
||
|
||
# 安装Playwright浏览器
|
||
RUN playwright install chromium
|
||
RUN playwright install-deps chromium
|
||
|
||
# 复制应用代码
|
||
COPY . .
|
||
|
||
EXPOSE 8000
|
||
|
||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|