diff --git a/.teamcity/settings.kts b/.teamcity/settings.kts index 606cfab6fcef..2826c1006979 100644 --- a/.teamcity/settings.kts +++ b/.teamcity/settings.kts @@ -178,20 +178,13 @@ object ExamplesTemplate : Template({ #!/bin/bash set -e -x - sudo apt-get install -yq \ - gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \ - libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \ - libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 \ - libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates \ - fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget - yarn install rm -rf built-storybooks mkdir -p built-storybooks yarn build-storybooks """.trimIndent() - dockerImage = "node:10" + dockerImage = "buildkite/puppeteer" dockerImagePlatform = ScriptBuildStep.ImagePlatform.Linux } } diff --git a/lib/cli/src/extract.js b/lib/cli/src/extract.js index 247c9705de32..40a312b9e474 100644 --- a/lib/cli/src/extract.js +++ b/lib/cli/src/extract.js @@ -6,8 +6,7 @@ import getPort from 'get-port'; import { logger } from '@storybook/node-logger'; const read = async url => { - const puppeteer = await usePuppeteer(); - const browser = await puppeteer.launch(); + const browser = await usePuppeteerBrowser(); const page = await browser.newPage(); await page.goto(url); @@ -75,12 +74,10 @@ const useLocation = async input => { }); }; -const usePuppeteer = async () => { +const usePuppeteerBrowser = async () => { + const args = ['--no-sandbox ', '--disable-setuid-sandbox']; try { - // eslint-disable-next-line import/no-extraneous-dependencies, global-require - require('puppeteer'); - - return puppeteerCore; + return await puppeteerCore.launch({ args }); } catch (e) { // it's not installed logger.info('installing puppeteer...'); @@ -88,7 +85,7 @@ const usePuppeteer = async () => { // eslint-disable-next-line global-require require('child_process').exec( `node ${require.resolve(path.join('puppeteer-core', 'install.js'))}`, - error => (error ? reject(error) : resolve(puppeteerCore)) + error => (error ? reject(error) : resolve(puppeteerCore.launch({ args }))) ); }); }