Skip to content

Commit 0f9a617

Browse files
authored
Merge pull request #76 from brendandburns/dockerfile
Generate a jar with dependencies and build a Dockerfile for it.
2 parents 0dd2614 + 5e4c9b2 commit 0f9a617

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

examples/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM openjdk:8-alpine
2+
3+
COPY target/client-java-examples-0.2-SNAPSHOT-jar-with-dependencies.jar /examples.jar
4+
5+
CMD ["java", "-jar", "/examples.jar"]
6+
7+

examples/pom.xml

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
<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">
1+
<project
2+
xmlns="http://maven.apache.org/POM/4.0.0"
3+
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">
24
<modelVersion>4.0.0</modelVersion>
35
<groupId>io.kubernetes</groupId>
46
<artifactId>client-java-examples</artifactId>
57
<version>0.2-SNAPSHOT</version>
68
<packaging>jar</packaging>
79
<name>client-java-examples</name>
810
<url>https://github.com/kubernetes-client/java</url>
9-
1011
<parent>
1112
<groupId>io.kubernetes</groupId>
1213
<artifactId>client-java-parent</artifactId>
1314
<version>0.2-SNAPSHOT</version>
1415
</parent>
15-
1616
<dependencies>
1717
<dependency>
1818
<groupId>io.kubernetes</groupId>
@@ -52,6 +52,28 @@
5252
<skip>true</skip>
5353
</configuration>
5454
</plugin>
55+
<plugin>
56+
<groupId>org.apache.maven.plugins</groupId>
57+
<artifactId>maven-assembly-plugin</artifactId>
58+
<executions>
59+
<execution>
60+
<phase>package</phase>
61+
<goals>
62+
<goal>single</goal>
63+
</goals>
64+
<configuration>
65+
<archive>
66+
<manifest>
67+
<mainClass>io.kubernetes.client.examples.Example</mainClass>
68+
</manifest>
69+
</archive>
70+
<descriptorRefs>
71+
<descriptorRef>jar-with-dependencies</descriptorRef>
72+
</descriptorRefs>
73+
</configuration>
74+
</execution>
75+
</executions>
76+
</plugin>
5577
</plugins>
5678
</build>
5779
<properties>
@@ -66,4 +88,4 @@
6688
<junit-version>4.12</junit-version>
6789
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
6890
</properties>
69-
</project>
91+
</project>

0 commit comments

Comments
 (0)