Skip to content

Commit

Permalink
Added docker image generation through fabric8 docker maven plugin
Browse files Browse the repository at this point in the history
the plugin is used in each of the 2 maven profiles (`standalone` and `all-in-one`) to pick up the corresponding Dockerfile (`Dockerfile_standalone` and `Dockerfile_all-in-one`) and build the appropriate docker image (`restcomm/restcomm` and `restcomm/connect` respectively).

For the moment - and this is perhaps a point for discussion - the plugin's `build` goal is bound to the `pre-integration-test` phase, as the fabric8 philosophy suggests you build a docker image (which is the resulting binary artifact from your maven build) and then you `start` it - still within the `pre-integration-test` phase - (together with all of its dependencies, e.g. database docker containers, 3rd party dependencies, etc.) so that you can then run the `verify` phase tests against the running system.
There is also a binding to the plugin's `stop` goal, in the `post-integration-phase`, which tears down the above setup.

I am leaving some of the above bindings commented out, on purpose, so you, oh dear reviewer, can get a better idea of how this works, in case you're not familiar.

Whether we choose to adopt this setup (which in my previous experience is pretty damn awesome!! ) largely depends however on what tests we already run in the `verify` phase and whether we would care to move some to other phases - or even other jenkins pipeline stages.

If we don't want to adopt the above approach, then we can consider binding the docker image creation in some other phase of mvn lifecycle.
  • Loading branch information
Yorgos Saslis committed May 5, 2018
1 parent b90b586 commit 1b6acaf
Showing 1 changed file with 80 additions and 0 deletions.
80 changes: 80 additions & 0 deletions release/restcomm-assembly-as7/pom.xml
Expand Up @@ -103,6 +103,46 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.25.2</version>

<configuration>
<images>
<image>
<name>restcomm/restcomm</name>
<build>
<tags>
<tag>${project.version}</tag>
<tag>latest</tag>
</tags>
<filter>${*}</filter>
<dockerFile>../../../Dockerfile_all-in-one</dockerFile>
</build>
</image>
</images>
</configuration>
<executions>
<execution>
<id>start</id>
<phase>pre-integration-test</phase>
<goals>
<!-- "build" should be used to create the images with the
artifact -->
<goal>build</goal>
<!--<goal>start</goal> not running any containers yet-->
</goals>
</execution>
<execution>
<id>stop</id>
<phase>post-integration-test</phase>
<goals>
<!--<goal>stop</goal> not running any containers yet -->
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Expand Down Expand Up @@ -168,6 +208,46 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.25.2</version>

<configuration>
<images>
<image>
<name>restcomm/connect</name>
<build>
<tags>
<tag>${project.version}</tag>
<tag>latest</tag>
</tags>
<filter>${*}</filter>
<dockerFileDir>../../../Dockerfile_standalone</dockerFileDir>
</build>
</image>
</images>
</configuration>
<executions>
<execution>
<id>start</id>
<phase>pre-integration-test</phase>
<goals>
<!-- "build" should be used to create the images with the
artifact -->
<goal>build</goal>
<!--<goal>start</goal> not running any containers yet-->
</goals>
</execution>
<execution>
<id>stop</id>
<phase>post-integration-test</phase>
<goals>
<!--<goal>stop</goal> not running any containers yet -->
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down

0 comments on commit 1b6acaf

Please sign in to comment.