feat: 更新 Dockerfile 安装 Playwright,更新 README 文档
This commit is contained in:
+25
-5
@@ -10,8 +10,26 @@ ENV PYTHONDONTWRITEBYTECODE=1
|
||||
# 确保 Python 输出不被缓冲
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
# 安装系统依赖(如有需要)
|
||||
# RUN apt-get update && apt-get install -y --no-install-recommends gcc && rm -rf /var/lib/apt/lists/*
|
||||
# 安装 Playwright 所需的系统依赖
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
wget \
|
||||
ca-certificates \
|
||||
fonts-liberation \
|
||||
libasound2 \
|
||||
libatk-bridge2.0-0 \
|
||||
libatk1.0-0 \
|
||||
libcups2 \
|
||||
libdbus-1-3 \
|
||||
libdrm2 \
|
||||
libgbm1 \
|
||||
libgtk-3-0 \
|
||||
libnspr4 \
|
||||
libnss3 \
|
||||
libxcomposite1 \
|
||||
libxdamage1 \
|
||||
libxrandr2 \
|
||||
xdg-utils \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 复制依赖文件
|
||||
COPY requirements.txt .
|
||||
@@ -20,15 +38,17 @@ COPY requirements.txt .
|
||||
# 使用阿里云镜像源加速
|
||||
RUN pip install --no-cache-dir -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
|
||||
|
||||
# 安装 Playwright Chromium 浏览器
|
||||
RUN playwright install --with-deps chromium
|
||||
|
||||
# 复制当前目录内容到容器中的 /app
|
||||
COPY . .
|
||||
|
||||
# 创建上传目录(确保权限)
|
||||
RUN mkdir -p uploads && chmod 777 uploads
|
||||
# 创建上传目录和数据目录(确保权限)
|
||||
RUN mkdir -p uploads data downloads && chmod 777 uploads data downloads
|
||||
|
||||
# 暴露端口 5000
|
||||
EXPOSE 5000
|
||||
|
||||
# 运行 app.py
|
||||
# 生产环境建议使用 gunicorn (需添加到 requirements.txt),但这里为了简单直接运行 python app.py
|
||||
CMD ["python", "app.py"]
|
||||
|
||||
Reference in New Issue
Block a user