forked from eclipse-jkube/jkube
-
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.
doc: Quickstart with external Dockerfile
Signed-off-by: Marc Nuri <[email protected]>
- Loading branch information
Showing
5 changed files
with
176 additions
and
0 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
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,118 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (c) 2019 Red Hat, Inc. | ||
This program and the accompanying materials are made | ||
available under the terms of the Eclipse Public License 2.0 | ||
which is available at: | ||
https://www.eclipse.org/legal/epl-2.0/ | ||
SPDX-License-Identifier: EPL-2.0 | ||
Contributors: | ||
Red Hat, Inc. - initial API and implementation | ||
--> | ||
<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>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>2.2.6.RELEASE</version> | ||
</parent> | ||
|
||
<groupId>org.eclipse.jkube.quickstarts.maven</groupId> | ||
<artifactId>docker-file-provided</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<name>Eclipse JKube :: Quickstarts :: Maven :: Docker File Provided</name> | ||
<packaging>jar</packaging> | ||
|
||
<description>Minimal Example with Spring Boot and a provided external Dockerfile</description> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<profiles> | ||
<profile> | ||
<id>kubernetes</id> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.eclipse.jkube</groupId> | ||
<artifactId>kubernetes-maven-plugin</artifactId> | ||
<version>${project.version}</version> | ||
<configuration> | ||
<images> | ||
<image> | ||
<name>jkube/docker-file-provided</name> | ||
<build> | ||
<contextDir>${project.basedir}</contextDir> | ||
<dockerFile>src/main/docker/Dockerfile</dockerFile> | ||
</build> | ||
</image> | ||
</images> | ||
<enricher> | ||
<config> | ||
<jkube-service> | ||
<type>NodePort</type> | ||
<name>${artifactId}</name> | ||
<port>8080:8080</port> | ||
</jkube-service> | ||
</config> | ||
</enricher> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
<profile> | ||
<id>openshift</id> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.eclipse.jkube</groupId> | ||
<artifactId>openshift-maven-plugin</artifactId> | ||
<version>${project.version}</version> | ||
<configuration> | ||
<images> | ||
<image> | ||
<name>jkube/docker-file-provided</name> | ||
<build> | ||
<contextDir>${project.basedir}</contextDir> | ||
<dockerFile>src/main/docker/Dockerfile</dockerFile> | ||
</build> | ||
</image> | ||
</images> | ||
<enricher> | ||
<config> | ||
<jkube-service> | ||
<type>NodePort</type> | ||
<name>${artifactId}</name> | ||
<port>8080:8080</port> | ||
</jkube-service> | ||
</config> | ||
</enricher> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
</profiles> | ||
|
||
</project> |
4 changes: 4 additions & 0 deletions
4
quickstarts/maven/docker-file-provided/src/main/docker/Dockerfile
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,4 @@ | ||
FROM fabric8/s2i-java:latest-java11 | ||
EXPOSE 8080/tcp | ||
COPY maven/*.jar /opt/app.jar | ||
ENTRYPOINT [ "java", "-jar", "/opt/app.jar" ] |
26 changes: 26 additions & 0 deletions
26
...r-file-provided/src/main/java/org/eclipse/jkube/maven/sample/spring/boot/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,26 @@ | ||
/** | ||
* Copyright (c) 2019 Red Hat, Inc. | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at: | ||
* | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat, Inc. - initial API and implementation | ||
*/ | ||
package org.eclipse.jkube.maven.sample.spring.boot; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class Application { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(Application.class, args); | ||
} | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
...le-provided/src/main/java/org/eclipse/jkube/maven/sample/spring/boot/HelloController.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,27 @@ | ||
/** | ||
* Copyright (c) 2019 Red Hat, Inc. | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at: | ||
* | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat, Inc. - initial API and implementation | ||
*/ | ||
package org.eclipse.jkube.maven.sample.spring.boot; | ||
|
||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
public class HelloController { | ||
|
||
@RequestMapping("/") | ||
public String index() { | ||
return "Greetings from Spring Boot with provided Dockerfile!"; | ||
} | ||
|
||
} |