Zenika / alpine-chrome

Chrome Headless docker images built upon alpine official image
https://hub.docker.com/r/zenika/alpine-chrome
Apache License 2.0
1.82k stars 241 forks source link

alpine linux and puppeteer issues #156

Closed bboydflo closed 3 years ago

bboydflo commented 3 years ago

Context

I am trying to use puppeteer inside an alpine linux image and steer the chromium version that comes with puppeteer. For some reason I get some issues, something like this:

(using the latest version of puppeteer as of now 6.0)

Error: Failed to launch the browser process! spawn node_modules/puppeteer/.local-chromium/linux-843427/chrome-linux/chrome ENOENT

TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md

    at onClose (/noc-reporting-tool/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:193:20)
    at ChildProcess.<anonymous> (/noc-reporting-tool/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:185:85)
    at ChildProcess.emit (events.js:314:20)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:274:12)
    at onErrorNT (internal/child_process.js:470:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! noc-reporting-tool@2.0.0 test:e2e: `jest -i --testPathPattern e2e`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the noc-reporting-tool@2.0.0 test:e2e script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Also I am not sure why most if not all the Dockerfile examples I saw are skipping downloading chromium version that comes in with puppeteer.

Alternatives

I can achieve what I need by defining a couple of envionment variables inside Dockerfile

ENV CHROME_BIN=/usr/bin/chromium-browser \
    CHROME_PATH=/usr/lib/chromium \
    PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1 \
    PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser

Has the feature been requested before?

Not sure.

If the feature request is accepted, would you be willing to submit a PR?

Yes


Bottom line I would like to try a working example of Dockerfile based on alpine linux that uses the chromium version that comes in with puppeteer.

Thanks!

jlandure commented 3 years ago

Hi @bboydflo ๐Ÿ‘‹

Thanks for submitting this issue.

First of all, please notice that this project aims to create a tiny Docker image with an embed Chromium. In my Dockerfile example, I don't want to download and install another Chromium in the with-puppeteer version because my Docker image aldreay got one Chromium up and ready. Please see this folder: https://github.com/Zenika/alpine-chrome/tree/master/with-puppeteer

I see your last comment

Bottom line I would like to try a working example of Dockerfile based on alpine linux that uses the chromium version that comes in with puppeteer.

You have an example here: https://github.com/puppeteer/puppeteer/blob/26fa363443b5929e25ae39c38a7627513928b887/docs/troubleshooting.md#running-on-alpine FYI, Alpine seems to not support the last Chromium x puppeteer version. If you have problems with puppeteer, you should create an issue on https://github.com/puppeteer/puppeteer

I hope this helps. ๐Ÿ˜Š

bboydflo commented 3 years ago

Thanks!

My motivation is to use the version of chromium that comes in with puppeteer so that I can control the exact chromium version. As you said I think there are issues with the latest chromium on alpine.

Will close this for now.

jlandure commented 3 years ago

Thanks for your reply @bboydflo ๐Ÿ‘

bboydflo commented 3 years ago

Thank you for this project!