Merge pull request #11388 from swapanpramanick2004/BAEL-4546
BAEL-4546 How to Get Docker-Compose to Always Use the Latest Image
This commit is contained in:
commit
0356a2f6da
3
docker/docker-sample-app/Dockerfile
Normal file
3
docker/docker-sample-app/Dockerfile
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
FROM openjdk:11
|
||||||
|
COPY target/docker-sample-app-0.0.1.jar app.jar
|
||||||
|
ENTRYPOINT ["java","-jar","/app.jar"]
|
3
docker/docker-sample-app/README.md
Normal file
3
docker/docker-sample-app/README.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
### Relevant Articles:
|
||||||
|
|
||||||
|
- How to Get Docker-Compose to Always Use the Latest Image
|
8
docker/docker-sample-app/docker-compose-build-image.yaml
Normal file
8
docker/docker-sample-app/docker-compose-build-image.yaml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
version: '2.4'
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: postgres
|
||||||
|
my_app:
|
||||||
|
build: .
|
||||||
|
ports:
|
||||||
|
- "8080:8080"
|
9
docker/docker-sample-app/docker-compose-with-image.yaml
Normal file
9
docker/docker-sample-app/docker-compose-with-image.yaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
version: '2.4'
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: postgres
|
||||||
|
my_app:
|
||||||
|
image: "eugen/test-app:latest"
|
||||||
|
ports:
|
||||||
|
- "8080:8080"
|
||||||
|
|
45
docker/docker-sample-app/pom.xml
Normal file
45
docker/docker-sample-app/pom.xml
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.baeldung.docker</groupId>
|
||||||
|
<artifactId>docker</artifactId>
|
||||||
|
<version>0.0.1</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>docker-sample-app</artifactId>
|
||||||
|
<name>docker-sample-app</name>
|
||||||
|
<description>Demo project for Spring Boot and Docker</description>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<java.version>11</java.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.baeldung.docker.app;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
public class DockAppApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(DockAppApplication.class, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.baeldung.docker.app.endpoint;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
public class MyController {
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public String version() {
|
||||||
|
return "1.7";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.baeldung.docker.app;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
class DockAppApplicationUnitTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void contextLoads() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -25,6 +25,7 @@
|
|||||||
<modules>
|
<modules>
|
||||||
<module>docker-internal-dto</module>
|
<module>docker-internal-dto</module>
|
||||||
<module>docker-spring-boot</module>
|
<module>docker-spring-boot</module>
|
||||||
|
<module>docker-sample-app</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user