JAVA-12420 Renamed docker to docker-modules

This commit is contained in:
Dhawal Kapil
2022-06-03 17:47:09 +05:30
parent 4413c8d66d
commit 89f020387f
70 changed files with 10 additions and 10 deletions
@@ -0,0 +1,16 @@
# To build, run the following command from the top level project directory:
#
# docker build -f src/main/docker/Dockerfile .
FROM adoptopenjdk:11-jre-hotspot as builder
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} application.jar
RUN java -Djarmode=layertools -jar application.jar extract
FROM adoptopenjdk:11-jre-hotspot
COPY --from=builder dependencies/ ./
COPY --from=builder spring-boot-loader/ ./
COPY --from=builder internal-dependencies/ ./
COPY --from=builder snapshot-dependencies/ ./
COPY --from=builder application/ ./
ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"]
@@ -0,0 +1,11 @@
# To build and run docker-with-spring-profile:
#
# docker build -f src/main/docker/springprofile/Dockerfile --tag=docker-with-spring-profile:latest .
# docker run docker-with-spring-profile:latest
#
# To run with profiles:
# docker run -e "SPRING_PROFILES_ACTIVE=test1,test2,test3" docker-with-spring-profile:latest
FROM openjdk:11
COPY target/*.jar app.jar
ENTRYPOINT ["java", "-jar", "/app.jar"]
@@ -0,0 +1,6 @@
version: "3.5"
services:
docker-with-spring-profile:
image: docker-with-spring-profile:latest
environment:
- "SPRING_PROFILES_ACTIVE=prod"
@@ -0,0 +1,6 @@
version: "3.5"
services:
docker-with-spring-profile:
image: docker-with-spring-profile:latest
environment:
- "SPRING_PROFILES_ACTIVE=test"
@@ -0,0 +1,13 @@
package com.baeldung.docker.spring;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
@@ -0,0 +1,16 @@
package com.baeldung.docker.spring;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloController {
@GetMapping("/hello")
public ResponseEntity<String> hello()
{
return ResponseEntity.ok("hello2 ");
}
}