Here is where we start, a 800Mb+ size image just to run headless Chrome and Jest. Ouch.
So lets apply the multi-stage build paradigm and use the Google Distroless NodeJs Image:
Now we rebuild the image using the `build . -t davidjeddy/docker_puppeteer_jest` command and we end up with a ~ 400MB images. 50% Savings!
Now remove the old busted and bloated image `docker rmi davidjeddy/docker_puppeteer_jest`.
Run the image command as normal and observe the same expected output as before. Unfortunately for the example project herein more work is needed as the original image did not keep dependences within the app dir.
After building your service image, make an addition step that plops it into a distroless base image. Boosh, easy win.
Fast forward to March 2018 and not only has the containerization tooling but advanced significantly but also the headless Chrome control systems. As such I sat down once gain to look into this tool chain. I am happy to announce `Docker Puppeteer Jest‘ docker image. As the name suggests running the image will spin up a headless Chrome instance, controlled by Puppeteer that triggers Jest test suites. Outputting both terminal response and image captures if so instructed.
Checkout the image on the Docker Hub or the repo on GitHub. Let me know what you think or if you find it useful. I’d love to hear from you.