forked from fabric8io/docker-maven-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix fabric8io#554: Add support for multiple copy layers using multipl…
…e assemblies Signed-off-by: Brian O'Keefe <zer0keefie@gmail.com>
- Loading branch information
1 parent
308792b
commit 64ac850
Showing
31 changed files
with
1,378 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>io.fabric8.dmp.itests</groupId> | ||
<artifactId>dmp-it-parent</artifactId> | ||
<version>0.34-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>dmp-multi-assembly</artifactId> | ||
<version>0.34-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<description>Docker Maven Plugin Example with Spring Boot with Multiple Layers</description> | ||
|
||
<distributionManagement> | ||
<snapshotRepository> | ||
<id>sonatype-nexus-snapshots</id> | ||
<name>Sonatype Nexus Snapshots</name> | ||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url> | ||
</snapshotRepository> | ||
<repository> | ||
<id>sonatype-nexus-staging</id> | ||
<name>Nexus Release Repository</name> | ||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url> | ||
</repository> | ||
</distributionManagement> | ||
<properties> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
<docker.user>fabric8</docker.user> | ||
<spring.version>2.3.3.RELEASE</spring.version> | ||
</properties> | ||
|
||
<dependencies> | ||
|
||
<!-- Boot generator --> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter</artifactId> | ||
<version>${spring.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-actuator</artifactId> | ||
<version>${spring.version}</version> | ||
</dependency> | ||
|
||
<!-- API, java.xml.bind module --> | ||
<dependency> | ||
<groupId>jakarta.xml.bind</groupId> | ||
<artifactId>jakarta.xml.bind-api</artifactId> | ||
<version>2.3.2</version> | ||
</dependency> | ||
|
||
<!-- Runtime, com.sun.xml.bind module --> | ||
<dependency> | ||
<groupId>org.glassfish.jaxb</groupId> | ||
<artifactId>jaxb-runtime</artifactId> | ||
<version>2.3.2</version> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<version>3.2.0</version> | ||
<configuration> | ||
<archive> | ||
<manifest> | ||
<addClasspath>true</addClasspath> | ||
<mainClass>io.fabric8.maven.sample.springboot.layers.Application</mainClass> | ||
<classpathPrefix>lib/</classpathPrefix> | ||
</manifest> | ||
</archive> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
<version>${spring.version}</version> | ||
</plugin> | ||
<plugin> | ||
<groupId>io.fabric8</groupId> | ||
<artifactId>docker-maven-plugin</artifactId> | ||
<version>0.34-SNAPSHOT</version> | ||
<configuration> | ||
<verbose>true</verbose> | ||
<images> | ||
<image> | ||
<name>${docker.user}/dmp-multi-assembly</name> | ||
<build> | ||
<from>fabric8/java-centos-openjdk8-jdk:1.5.6</from> | ||
<assemblies> | ||
<assembly> | ||
<descriptorRef>dependencies</descriptorRef> | ||
<name>deps</name> | ||
<targetDir>/app/lib</targetDir> | ||
</assembly> | ||
<assembly> | ||
<descriptorRef>artifact</descriptorRef> | ||
<targetDir>/app</targetDir> | ||
</assembly> | ||
</assemblies> | ||
<cmd>java -jar /app/${project.artifactId}-${project.version}.jar</cmd> | ||
<workdir>/app</workdir> | ||
<ports> | ||
<port>8080</port> | ||
</ports> | ||
</build> | ||
<run> | ||
<wait> | ||
<log>Hello from Spring Boot!</log> | ||
</wait> | ||
</run> | ||
</image> | ||
</images> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>docker-build</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>build</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>docker-run</id> | ||
<phase>pre-integration-test</phase> | ||
<goals> | ||
<goal>start</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>docker-stop</id> | ||
<phase>post-integration-test</phase> | ||
<goals> | ||
<goal>stop</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
29 changes: 29 additions & 0 deletions
29
it/multi-assembly/src/main/java/io/fabric8/maven/sample/springboot/layers/Application.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package io.fabric8.maven.sample.springboot.layers; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.boot.CommandLineRunner; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.context.ApplicationContext; | ||
import org.springframework.context.annotation.Bean; | ||
|
||
@SpringBootApplication | ||
public class Application { | ||
private static final Logger LOGGER = LoggerFactory.getLogger(Application.class); | ||
|
||
@Bean | ||
public CommandLineRunner commandLineRunner(ApplicationContext applicationContext) { | ||
return new CommandLineRunner() { | ||
@Override | ||
public void run(String... args) { | ||
LOGGER.info("Hello from Spring Boot!"); | ||
SpringApplication.exit(applicationContext); | ||
} | ||
}; | ||
} | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(Application.class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>io.fabric8.dmp.samples</groupId> | ||
<artifactId>dmp-sample-parent</artifactId> | ||
<version>0.34-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>dmp-sample-multi-assembly</artifactId> | ||
<version>0.34-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<description>Docker Maven Plugin Example with Spring Boot with Multiple Layers</description> | ||
|
||
<distributionManagement> | ||
<snapshotRepository> | ||
<id>sonatype-nexus-snapshots</id> | ||
<name>Sonatype Nexus Snapshots</name> | ||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url> | ||
</snapshotRepository> | ||
<repository> | ||
<id>sonatype-nexus-staging</id> | ||
<name>Nexus Release Repository</name> | ||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url> | ||
</repository> | ||
</distributionManagement> | ||
<properties> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
<docker.user>fabric8</docker.user> | ||
<spring.version>2.3.3.RELEASE</spring.version> | ||
</properties> | ||
|
||
<dependencies> | ||
|
||
<!-- Boot generator --> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter</artifactId> | ||
<version>${spring.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-actuator</artifactId> | ||
<version>${spring.version}</version> | ||
</dependency> | ||
|
||
<!-- API, java.xml.bind module --> | ||
<dependency> | ||
<groupId>jakarta.xml.bind</groupId> | ||
<artifactId>jakarta.xml.bind-api</artifactId> | ||
<version>2.3.2</version> | ||
</dependency> | ||
|
||
<!-- Runtime, com.sun.xml.bind module --> | ||
<dependency> | ||
<groupId>org.glassfish.jaxb</groupId> | ||
<artifactId>jaxb-runtime</artifactId> | ||
<version>2.3.2</version> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<version>3.2.0</version> | ||
<configuration> | ||
<archive> | ||
<manifest> | ||
<addClasspath>true</addClasspath> | ||
<mainClass>io.fabric8.maven.sample.springboot.layers.Application</mainClass> | ||
<classpathPrefix>lib/</classpathPrefix> | ||
</manifest> | ||
</archive> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
<version>${spring.version}</version> | ||
</plugin> | ||
<plugin> | ||
<groupId>io.fabric8</groupId> | ||
<artifactId>docker-maven-plugin</artifactId> | ||
<version>0.34-SNAPSHOT</version> | ||
<configuration> | ||
<verbose>true</verbose> | ||
<images> | ||
<image> | ||
<name>${docker.user}/dmp-sample-multi-assembly</name> | ||
<build> | ||
<from>fabric8/java-centos-openjdk8-jdk:1.5.6</from> | ||
<assemblies> | ||
<assembly> | ||
<descriptorRef>dependencies</descriptorRef> | ||
<name>deps</name> | ||
<targetDir>/app/lib</targetDir> | ||
</assembly> | ||
<assembly> | ||
<descriptorRef>artifact</descriptorRef> | ||
<targetDir>/app</targetDir> | ||
</assembly> | ||
</assemblies> | ||
<cmd>java -jar /app/${project.artifactId}-${project.version}.jar</cmd> | ||
<ports> | ||
<port>8080</port> | ||
</ports> | ||
</build> | ||
<run> | ||
<wait> | ||
<log>Hello from Spring Boot!</log> | ||
</wait> | ||
</run> | ||
</image> | ||
</images> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>docker-build</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>build</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>docker-run</id> | ||
<phase>verify</phase> | ||
<goals> | ||
<goal>start</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
29 changes: 29 additions & 0 deletions
29
...s/multi-assembly/src/main/java/io/fabric8/maven/sample/springboot/layers/Application.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package io.fabric8.maven.sample.springboot.layers; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.boot.CommandLineRunner; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.context.ApplicationContext; | ||
import org.springframework.context.annotation.Bean; | ||
|
||
@SpringBootApplication | ||
public class Application { | ||
private static final Logger LOGGER = LoggerFactory.getLogger(Application.class); | ||
|
||
@Bean | ||
public CommandLineRunner commandLineRunner(ApplicationContext applicationContext) { | ||
return new CommandLineRunner() { | ||
@Override | ||
public void run(String... args) { | ||
LOGGER.info("Hello from Spring Boot!"); | ||
SpringApplication.exit(applicationContext); | ||
} | ||
}; | ||
} | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(Application.class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.