Git Product home page Git Product logo

docker-chromium-xvfb's Introduction

Chromium in Docker via Xvfb

This Docker image provides a way to run a real Chromium / Chrome browser headless inside of a Docker container. If you're looking for a way to run your Karma or Python Selenium tests against Chrome using Docker, this is the project you've been looking for! Use cases include:

  • Run Javascript tests with Karma inside of Docker during local development or CI builds
  • Run Selenium-powered browser automation tests using Python inside of Docker during your CI builds
  • and pretty much anything else where you'd want to use a real Chrome browser within a Docker container

Images

  • markadams/chromium-xvfb Base Docker image (Installs Debian, Chromium, Xvfb)
  • markadams/chromium-xvfb-js Designed for running headless JS tests in Chromium (includes iojs (node) and npm) This image automatically runs npm install and npm test
  • markadams/chromium-xvfb-py2 Designed for running headless Selenium tests in Chromium (Python 2) This image automatically runs pip install -r requirements.txt
  • markadams/chromium-xvfb-py3 Designed for running headless Selenium tests in Chromium (Python 3) This image automatically runs pip3 install -r requirements.txt

Methodology

The key to this project and to getting Chromium / Google Chrome to work inside of a container is the wrapper script, xvfb-chromium.

The wrapper script does a number of things:

  1. Launches the X virtual frame buffer (Xvfb) which emulates an X11 display so that the GUI code in the browser has a display to interact with.
  2. Launches Chromium / Google Chrome and passes along any command line arguments to the browser process.
  3. Traps SIGTERM and relays the signal to the browser and Xvfb so that they will not continue to run once the test runner is finished. This is mostly required to deal with Karma's insistence that the browser process be terminated before it can exit. Without this relaying, Karma would hang indefinitely.

Directories

  • /images - Contains the sources for all of the chromium-xvfb-* images
  • /samples - This image contains an example of running tests for JS / Karma and Selenium with Python 2 and 3.

Running the sample applications

  1. cd into any of the projects in /samples
  2. docker build -t sample .
  3. docker run sample

The sample application will run the example test and output its results to the console as well as a xunit-format XML file in the test-results/ directory inside of the container.

docker-chromium-xvfb's People

Contributors

mark-adams avatar wbinnssmith avatar johannesrudolph avatar mbertrand80 avatar mschwager avatar mafrauen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.