The WildFly Camel project provides a container image which is capable of performing Source To Image (S2I) builds.
First some preamble on what S2I is and how it works. It enables you to produce repeatable builds of docker images from source code.
An S2I builder image contains the required toolchain for building your project. For Java, that’s usually Maven or Gradle. For Ruby apps a builder image might contain bundler to install Ruby Gems etc, and a Golang app builder image would contain the Go compiler.
For a Java builder image, if it sees that the provided source code contains a pom.xml file, it can assume that it’s possible to run a Maven build to package the application. For WildFly, this usually means producing a JAR, WAR or EAR. When the Maven build completes successfully, the builder image copies any built artifacts across to the WildFly deployments directory.
Here are some ways in which you can create and deploy Camel projects using the S2I builder image.
Local directory S2I build
To start with, grab the S2I client binary from the project releases page. Then switch to a Maven project directory for any deployable JAR or WAR project and run:
You can also run an S2I build on a directory containing pre-assembled artifacts. In this case there is no need for the builder image to run a Maven build.
When the S2I build is complete, you can run your application with docker:
Remote S2I build
You can also perform S2I builds using the URL to a git repository.
OpenShift S2I template build
The WildFly Camel project provides an OpenShift ImageStream. You can add it to your cluster as follows:
Next install the WildFly Camel S2I application template:
Now browse to the OpenShift web console, choose from an existing project or create a new one. Click ‘Browse Catalog’. You should see an option to select named ‘WildFly Camel’:
Fill out the template parameters and click finish to start the S2I build.
When the build completes successfully you will see a running pod.
Hopefully this is a good introduction to S2I with WildFly Camel. If you want to learn more, check out some of these links: