Skip to content

Instantly share code, notes, and snippets.

@cescoffier
Created June 16, 2016 15:53
Show Gist options
  • Save cescoffier/0b3bd518141f42034e6b73edd6bd6564 to your computer and use it in GitHub Desktop.
Save cescoffier/0b3bd518141f42034e6b73edd6bd6564 to your computer and use it in GitHub Desktop.
Vert.x applications on openshift: shade, fabric8
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.redhat.developers.reactive-msa</groupId>
<artifactId>hello</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<vertx.version>3.3.0-SNAPSHOT</vertx.version>
<main.verticle>com.redhat.developers.msa.reactive.hello.HelloVerticle</main.verticle>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-dependencies</artifactId>
<version>${vertx.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-core</artifactId>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-hazelcast</artifactId>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-circuit-breaker</artifactId>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-service-discovery-bridge-kubernetes</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.21</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>io.vertx.core.Launcher</Main-Class>
<Main-Verticle>${main.verticle}</Main-Verticle>
</manifestEntries>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/services/io.vertx.core.spi.VerticleFactory</resource>
</transformer>
</transformers>
<artifactSet>
</artifactSet>
<outputFile>${project.build.directory}/${project.artifactId}-${project.version}-fat.jar</outputFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>oss.snapshot</id>
<name>Sonatype OSS Repository</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
</repositories>
<profiles>
<profile>
<id>openshift</id>
<properties>
<fabric8.service.hello.name>hello</fabric8.service.hello.name>
<fabric8.service.hello.port>80</fabric8.service.hello.port>
<fabric8.service.hello.containerPort>8080</fabric8.service.hello.containerPort>
<fabric8.service.hello.type>LoadBalancer</fabric8.service.hello.type>
<fabric8.label.service-type>http-endpoint</fabric8.label.service-type>
<fabric8.label.vertx-cluster>true</fabric8.label.vertx-cluster>
<docker.group.name>reactive-msa</docker.group.name>
<docker.image>${docker.group.name}/${project.artifactId}:${project.version}</docker.image>
<fabric8.dockerUser>me</fabric8.dockerUser>
</properties>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.14.2</version>
<configuration>
<images>
<image>
<name>${docker.image}</name>
<build>
<from>java:8-jre-alpine</from>
<tags>
<tag>latest</tag>
<tag>${project.version}</tag>
</tags>
<workdir>/opt</workdir>
<entryPoint>
<exec>
<arg>java</arg>
<arg>-jar</arg>
<arg>${project.artifactId}-${project.version}-fat.jar</arg>
<arg>-cluster</arg>
<arg>-cp</arg>
<arg>.</arg>
<arg>-conf</arg>
<arg>config.json</arg>
</exec>
</entryPoint>
<runCmds>
<runcmd>chmod -R 777 /opt</runcmd>
<runcmd>chmod -R 777 /opt/*</runcmd>
</runCmds>
<assembly>
<basedir>/</basedir>
<inline>
<files>
<file>
<source>${project.build.directory}/${project.artifactId}-${project.version}-fat.jar</source>
<outputDirectory>/opt</outputDirectory>
<fileMode>0755</fileMode>
</file>
</files>
<fileSets>
<fileSet>
<directory>${project.basedir}/src/openshift/</directory>
<outputDirectory>/opt</outputDirectory>
<fileMode>0755</fileMode>
</fileSet>
</fileSets>
</inline>
</assembly>
</build>
</image>
</images>
</configuration>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<version>2.2.96</version>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment