Skip to content

Docker-compose wrapper for the JVM

License

Notifications You must be signed in to change notification settings

meltwater/kotlin-compose

Repository files navigation

Overview

Kotlin-compose is a docker-compose wrapper for the JVM. This library is mainly intended to be used in embedded integration tests.

Build Status jcenter Maven Central

How to use it

Dependencies

Gradle:

    
repositories {
   jcenter()
}
...

dependencies {
    compile 'com.meltwater.docker:kotlin-compose:$VERSION'
    ...
}

Maven:

    <dependency>
      <groupId>com.meltwater.docker</groupId>
      <artifactId>kotlin-compose</artifactId>
      <version>$VERSION</version>
      <type>jar</type>
    </dependency>

Java code example

// create the docker compose context giving a path to a docker compose yaml file, a machine uniqe prefix and 
// optinally provide some ENVIRONMENT variables that will be resolved in the yaml file
Map<String,String> env = new HashMap<>();
DockerCompose compose = new DockerCompose("docker-compose.yml", "uniqe-namespace", env);

// start the docker containers (note this method will return as soon as all containers are running)
compose.up();

// verify that all services inside the containers has started

// do your tests

// kill the containers (this method reurns when all containers has stopped)
compose.kill();

For more examples have a look at the unit tests

Building locally

./gradlew clean build

Install to your local .m2 directory:

./gradlew clean build publishJavaArtifactsPublicationToMavenLocal

Upload to jcenter

No new artifacts will be pushed to jcenter for the moment.

Upload to Artifactory

Upload to Meltwater Artifactory repository:

./gradlew clean build artifactoryPublish

With the following settings given in ~/.gradle/gradle.properties

systemProp.artifactory_user=..
systemProp.artifactory_password=..

License

MIT