Public | Automated Build

Last pushed: a year ago
Short Description
A Docker image that has sbt, firefox, and chromium installed.
Full Description




Background

This is a docker image that has SBT, Firefox, and Chromium installed. This lets you run ScalaJS tests in a browser using scala-js-env-selenium. OS X doesn't have a supported version of these browsers that can run headlessly in Xvfb. Running them in docker is a workaround for headless mode.

Usage

Run the following in the SBT project root.

docker run -it -v $(pwd):/app -v $HOME/.sbt:/cache/.sbt -v $HOME/.ivy2:/cache/.ivy2 --rm gshakhn/sbt-firefox-chromium

The -v $HOME/.sbt:/cache/.sbt -v $HOME/.ivy2:/cache/.ivy2 flags are theoretically optional, but if you don't have them, you'll have to download the dependencies each time. Why not use your local cache instead?

You may also want to add -p 8080:8080 to expose any web server you start in SBT. I use sbt-revolver.

See this blog post on how to configure SBT to run ScalaJS tests in the browser.

Xephyr

If you want to actually see Firefox or Chromium running (aka non-headless), you can make it show up in Xephyr running on the host machine.

Xephyr :1 -ac -screen 1280x1024 -listen tcp &
docker run -it -e DISPLAY=<YOUR_HOST_IP>:1-v $(pwd):/app -v $HOME/.sbt:/cache/.sbt -v $HOME/.ivy2:/cache/.ivy2 --rm gshakhn/sbt-firefox-chromium

Substitute YOUR_HOST_IP with your local machine's IP where Xephyr is running.

This blog post for more information on the pros/cons of this approach.

Docker Pull Command
Owner
gshakhn
Source Repository

Comments (0)