From: Kai Moritz Date: Sun, 25 Oct 2020 15:31:03 +0000 (+0100) Subject: The application can be started as a container via Docker Compose X-Git-Tag: part-1~4 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=ffffec121e9c1fb75642e669f9bdb05f444819dc;p=demos%2Fspring%2Fdata-jdbc The application can be started as a container via Docker Compose * Added docker-maven-plugin to build an image of the application * Added a setup for Docker Compose, that starts the image as container --- diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..1ad9963 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +* +!target/*.jar diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..89e2ebb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM openjdk:8-jre-alpine +VOLUME /tmp +COPY target/*.jar /opt/app.jar +ENTRYPOINT [ "/usr/bin/java", "-jar", "/opt/app.jar" ] +CMD [] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..79f5d1c --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,7 @@ +version: "3" + +services: + jdbc: + image: jdbc:latest + ports: + - 8080:8080 diff --git a/pom.xml b/pom.xml index 4cc7dc3..82dc5dd 100644 --- a/pom.xml +++ b/pom.xml @@ -60,6 +60,27 @@ org.springframework.boot spring-boot-maven-plugin + + io.fabric8 + docker-maven-plugin + 0.33.0 + + + + %a:%l + + + + + + build + package + + build + + + +