BAEL-54445 reorganize docker modules

This commit is contained in:
Loredana Crusoveanu
2022-07-01 16:55:58 +03:00
parent d331a6f2b2
commit 3f8cc6a92c
42 changed files with 20 additions and 635 deletions
+33
View File
@@ -0,0 +1,33 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
+4
View File
@@ -0,0 +1,4 @@
### Relevant Articles:
- [Pushing a Docker Image to a Private Repository](https://www.baeldung.com/ops/docker-push-image-to-private-repository)
- [How to Include Files Outside of Dockers Build Context](https://www.baeldung.com/ops/docker-include-files-outside-build-context)
@@ -0,0 +1,2 @@
FROM nginx:latest
COPY nginx.conf /etc/nginx/nginx.conf
@@ -0,0 +1,8 @@
events {}
http {
server {
listen 80;
index index.html;
}
}
@@ -0,0 +1,3 @@
FROM nginx:latest
COPY sample-site/html/* /etc/nginx/html/
COPY config/nginx.conf /etc/nginx/nginx.conf
@@ -0,0 +1,2 @@
FROM sample-site-base:latest
COPY html/* /etc/nginx/html/
@@ -0,0 +1,3 @@
FROM nginx:latest
COPY html/* /etc/nginx/html/
COPY config/nginx.conf /etc/nginx/nginx.conf
@@ -0,0 +1,6 @@
mkdir tmp-context
cp -R ../html tmp-context/
cp -R ../../config tmp-context/
cp Dockerfile-script tmp-context/Dockerfile
docker build -t sample-site:latest tmp-context
rm -rf tmp-context
@@ -0,0 +1,10 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Sample Site</title>
</head>
<body>
<h2>Welcome to the first page of the site</h2>
</body>
</html>
+46
View File
@@ -0,0 +1,46 @@
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>docker-images</artifactId>
<description>Example application to showcase Docker images features</description>
<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</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<properties>
<java.version>11</java.version>
</properties>
</project>
@@ -0,0 +1,4 @@
FROM openjdk:11
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java","-jar","/app.jar"]
@@ -0,0 +1,13 @@
package com.baeldung.docker;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class MainApplication {
public static void main(String[] args) {
SpringApplication.run(MainApplication .class, args);
}
}
@@ -0,0 +1,12 @@
package com.baeldung.docker.controllers;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloWorldController {
@GetMapping("/helloworld")
String helloWorld() {
return "Hello World!";
}
}