Here's a Drone Docker image with Node.js and Chrome headless

Published on Monday, November 20, 2017

I worked on a fun little aside this last week at work. We are using Drone to perform our CI builds (it's just like Travis CI). Well, the default Docker node image is built on Debian and when run on Drone 5 it does not contain all the packages needed to use Chrome Headless (as documented in this GH issue). We're using Puppeteer to run Chrome headless with Karma to run our Angular tests.

We were running a bash script to install them when the build started but I went ahead and just packaged it all as a Docker container. This is a general purpose container image but using it with Drone sped up our builds by an order of magnitude.

You can find it in my Drone image repository. I'll be sure to add anymore useful Drone images I end up making there too!

With Puppeteer, I also had to use these args:

--no-sandbox --disable-setuid-sandbox

It's possible you don't need them but once I got it working I didn't revisit it in depth.

I could also publish this to the public registry, just let me know in the comments if you'd like me to--otherwise, feel free to do so.

About Kamran
Hi, I'm a professional full-stack developer who also loves to write, speak at conferences, work on side projects, contribute to open source, make games, and play them.
comments powered by Disqus