Packaging

Launcher

To launch UShip, you just have to launch a CDI SE container. Using default implementation - Apache OpenWebBeans - it can be done using the default main(String…​): org.apache.openwebbeans.se.CDILauncher. For the web server you can use --openwebbeans.main uShipTomcatAwait argument with CDILauncher to await Tomcat server and not quit immediately.

Once you collected all dependencies to be able to build the application classpath, simply set this class a your main and your application will start.

Create docker images

We highly recommend using JIB to create the docker images but you can also use a plain Dockerfile if desired. This documentation will use jib to provide an end to end example.

Here is how to define Jib plugin to create a docker image:

<plugin>
    <groupId>com.google.cloud.tools</groupId>
    <artifactId>jib-maven-plugin</artifactId>
    <version>...</version>
    <configuration>
        <containerizingMode>packaged</containerizingMode>
        <from>
            <image>azul/zulu-openjdk-alpine:11.0.11-11.48.21-jre@sha256:355dfb25e12633692c1f34b7fccd29668efd583d3cfe18466e1ab28b0399b740</image>
        </from>
        <to>
            <image>company/${project.groupId}:${project.version}</image>
        </to>
        <container>
            <mainClass>org.apache.openwebbeans.se.CDILauncher</mainClass>
            <appRoot>/opt/${project.groupId}/${project.artifactId}</appRoot>
            <workingDirectory>/opt/${project.groupId}/${project.artifactId}</workingDirectory>
            <environment>
                <LANG>en_US.UTF-8</LANG>
            </environment>
            <jvmFlags>
                <jvmFlag>-Djava.util.logging.manager=io.yupiik.logging.jul.YupiikLogManager</jvmFlag>
                <jvmFlag>-Djava.security.egd=file:/dev/./urandom</jvmFlag>
            </jvmFlags>
            <ports>
                <port>8080</port>
            </ports>
        </container>
    </configuration>
</plugin>

Once configured you can build a local docker image using: mvn package jib:dockerBuild.

Tip
using mvn package jib:build, you can push the image to a remote registry without docker daemon. See jib documentation for more details.