JAVA-29231 Move modules inside existing container modules (#15492)
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
## Jib
|
||||
|
||||
This module contains articles about Jib.
|
||||
|
||||
### Relevant Articles:
|
||||
|
||||
- [Dockerizing Java Apps using Jib](https://www.baeldung.com/jib-dockerizing)
|
||||
@@ -0,0 +1,46 @@
|
||||
<?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>
|
||||
<artifactId>jib</artifactId>
|
||||
<name>jib</name>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../../parent-boot-2</relativePath>
|
||||
</parent>
|
||||
|
||||
<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>
|
||||
<plugin>
|
||||
<groupId>com.google.cloud.tools</groupId>
|
||||
<artifactId>jib-maven-plugin</artifactId>
|
||||
<version>${jib-maven-plugin.version}</version>
|
||||
<configuration>
|
||||
<to>
|
||||
<image>registry.hub.docker.com/baeldungjib/jib-spring-boot-app</image>
|
||||
</to>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<jib-maven-plugin.version>2.5.0</jib-maven-plugin.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.baeldung;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.baeldung;
|
||||
|
||||
public class Greeting {
|
||||
|
||||
private final long id;
|
||||
private final String content;
|
||||
|
||||
public Greeting(long id, String content) {
|
||||
this.id = id;
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.baeldung;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
@RestController
|
||||
public class GreetingController {
|
||||
|
||||
private static final String template = "Hello Docker, %s!";
|
||||
private final AtomicLong counter = new AtomicLong();
|
||||
|
||||
@GetMapping("/greeting")
|
||||
public Greeting greeting(@RequestParam(value="name", defaultValue="World") String name) {
|
||||
return new Greeting(counter.incrementAndGet(),
|
||||
String.format(template, name));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
### Relevant Articles:
|
||||
|
||||
- [An Introduction to Kaniko](https://www.baeldung.com/ops/kaniko)
|
||||
@@ -0,0 +1,2 @@
|
||||
FROM ubuntu
|
||||
ENTRYPOINT ["/bin/bash", "-c", "echo hello"]
|
||||
@@ -0,0 +1,19 @@
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: kaniko
|
||||
spec:
|
||||
containers:
|
||||
- name: kaniko
|
||||
image: gcr.io/kaniko-project/executor:latest
|
||||
args: ["--dockerfile=/workspace/dockerfile",
|
||||
"--context=dir://workspace",
|
||||
"--no-push"]
|
||||
volumeMounts:
|
||||
- name: dockerfile-storage
|
||||
mountPath: /workspace
|
||||
restartPolicy: Never
|
||||
volumes:
|
||||
- name: dockerfile-storage
|
||||
persistentVolumeClaim:
|
||||
claimName: dockerfile-claim
|
||||
@@ -0,0 +1,11 @@
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: dockerfile-claim
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 8Gi
|
||||
storageClassName: local-storage
|
||||
@@ -0,0 +1,14 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: dockerfile
|
||||
labels:
|
||||
type: local
|
||||
spec:
|
||||
capacity:
|
||||
storage: 10Gi
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
storageClassName: local-storage
|
||||
hostPath:
|
||||
path: /home/docker/kaniko # Path to the local mount directory that was setup
|
||||
@@ -22,6 +22,8 @@
|
||||
<module>docker-spring-boot</module>
|
||||
<module>docker-spring-boot-postgres</module>
|
||||
<module>docker-java-jar</module>
|
||||
<module>jib</module>
|
||||
<!-- <module>kaniko</module> --> <!-- Not a maven project -->
|
||||
</modules>
|
||||
|
||||
</project>
|
||||
Reference in New Issue
Block a user