I have three mechanisms in the same pom file which are put under different maven profiles.
-
Building Image with Spring Boot Build Plugin:
mvn clean verify spring-boot:build-image
-
Building Image with Fabric8:
mvn clean verify -DskipTests -Pbuild-with-fabric-8
-
Building Image with JIB:
mvn clean verify -DskipTests -Pbuild-with-jib
-
Push Image to Docker Hub:
mvn clean verify -DskipTests -Pdockerhub
-
Start the container
docker run --name spring-boot-docker-without-docker -p 8080:8080 spring-boot-docker-without-docker:0.0.1
-
APIs for testing :