alekzonder / docker-puppeteer

docker image with Google Puppeteer installed
https://hub.docker.com/r/alekzonder/puppeteer/
MIT License
486 stars 138 forks source link

Fails with 'jest-puppeteer' due to missing 'procps' package #46

Open joaocarmo opened 4 years ago

joaocarmo commented 4 years ago

I found this while using this image in GitLab's CI environment, using jest-puppeteer. The default globalTeardown relies on the ps utility which is not included by default.

It errors out:

PASS functional-tests/app.test.js
Test Suites: 2 passed, 2 total
Tests:       5 passed, 5 total
Snapshots:   0 total
Time:        18.289 s
Ran all test suites.
events.js:292
      throw er; // Unhandled 'error' event
      ^
Error: spawn ps ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn ps',
  path: 'ps',
  spawnargs: [ '-o', 'pid', '--no-headers', '--ppid', 119 ]
}

To work around this, I would need to install the procps package after pulling the image (using before_script):

apt-get update && apt-get install -y procps

Unfortunately, the user pptruser is non-privileged and there is no easy way of adding a package in a CI environment, so I suggest adding this to the base image.