添加部署文件
This commit is contained in:
+8
-1
@@ -25,6 +25,11 @@ from playwright.async_api import Browser, BrowserContext, Page, async_playwright
|
||||
# 页面打开超时(毫秒)
|
||||
_GOTO_TIMEOUT = 30000
|
||||
|
||||
# Chromium 启动参数:
|
||||
# --no-sandbox 容器内以 root 运行时 Chrome 沙箱不可用,不加会直接启动失败
|
||||
# --disable-dev-shm-usage 容器 /dev/shm 偏小时改用磁盘,避免渲染进程崩溃
|
||||
_LAUNCH_ARGS = ["--no-sandbox", "--disable-dev-shm-usage"]
|
||||
|
||||
|
||||
@dataclass
|
||||
class NodeSnapshot:
|
||||
@@ -202,7 +207,9 @@ class _BrowserRuntime:
|
||||
async with self._launch_lock:
|
||||
if self._browser is None:
|
||||
self._playwright = await async_playwright().start()
|
||||
self._browser = await self._playwright.chromium.launch(headless=True)
|
||||
self._browser = await self._playwright.chromium.launch(
|
||||
headless=True, args=_LAUNCH_ARGS
|
||||
)
|
||||
return self._browser
|
||||
|
||||
async def _open_page_impl(self, url: str, wait_ms: int) -> str:
|
||||
|
||||
Reference in New Issue
Block a user