Public | Automated Build

Last pushed: 2 months ago
Short Description
CentOS7 S2I image for building Ant-based (Java) applications on OpenShift
Full Description

This is a CentOS S2I image with JDK8 and Apache Ant preinstalled ready to run on OpenShift.
For more information about Apache Ant: http://ant.apache.org/.

To compile your Ant-based applications, a file called 'build.xml' must exist in the root context directory.
If you want to use an alternative build.xml file, set the environment variable BUILDFILE.
The whole compilation should be invoked by the ant default task.
If otherwise, you want to invoke an alternative task, set its name to the environment variable BUILD_TASK.

To run your application, an ant task called 'run' must exist in your build file.
If you want to run an alternative task, set its name to the environment variable RUN_TASK.
The application should listen on the port passed by the evnironment variable PORT.
You can pass additional environment variables to control the running of your Java application:

  • MAX_MEMORY: maximum JVM heap memory
  • JVM_ARGS: additional JVM arguments

To setup your build file to access the environment:

<property environment="env"/>
<!-- default environment variable values -->
<property name="env.MAX_MEMORY" value="100m"/>
<property name="env.JVM_ARGS" value=""/>
<property name="env.PORT" value="8080"/>

<!-- example run target where the port is passed as first argument to the app -->

<target name="run">
<java jar="path/to/your/jar/or/property" fork="true" failonerror="true" maxmemory="${env.MAX_MEMORY}">
<jvmarg line="${env.JVM_ARGS}"/>
<arg value="${env.PORT}"/>
</java>
</target>

It is assumed that the classes are built inside a directory called 'bin'. This directory
is cached across builds through the save-artifacts script.
If you have an alternative bin directory, set its name to the environment variable BIN_DIR.
Note: currently ant caching is not working as expected, check the source code of restore-artifacts

Docker Pull Command
Owner
hammady
Source Repository

Comments (0)