Config tweaks for docker

- Remove `$` interpolation for env
- Allow puppeteer to work headless in docker, headful with npx
This commit is contained in:
colinmcneil 2024-12-18 11:00:11 -05:00 • committed by Jim Clark
commit c64f8de15f
No known key found for this signature in database
GPG key ID: 73305B2338AAA7BE

View file

@ -108,7 +108,9 @@ const screenshots = new Map<string, string>();
async function ensureBrowser() {
if (!browser) {
browser = await puppeteer.launch({ headless: true, args: ["--no-sandbox"] });
const npx_args = { headless: false }
const docker_args = { headless: true, args: ["--no-sandbox", "--single-process", "--no-zygote"] }
browser = await puppeteer.launch(process.env.DOCKER_CONTAINER ? docker_args : npx_args);
const pages = await browser.pages();
page = pages[0];