aaronp / dockerenv

A utility for starting services in docker, typically to facilitate testing

GitHub

dockerenv

Build Status Maven Central Coverage Status Scaladoc

A lightweight means of starting/stopping external services (docker images) to facilitate testing/development.

See docs here

The gist is that we can easily spin up real services (databases, kafka clusters, etc) which we can then connect against.

e.g. Import docker env in your build like this:

libraryDependencies += "com.github.aaronp" %% "dockerenv" % "latest version" % "test" classifier "tests"
libraryDependencies += "com.github.aaronp" %% "dockerenv" % "latest version" % "test" 

Then use it like this:

      dockerenv.postgres().bracket { // the postgres DB is started here if it wasn't already running
        dockerenv.mysql().bracket { 
          // both postgres and mysql DB is started here if it wasn't already running
        }
        // mysql has been stopped, unless it was running
      }