I have three mechanisms in the same pom file which are put under different maven profiles.
- Java 25
- Spring Boot 4.1.1
- Maven 3.10 (via the Maven Wrapper
./mvnw) - Base images:
amazoncorretto:25/amazoncorretto:25-alpine3.22(JIB & Fabric8), Paketo buildpacks withBP_JVM_VERSION=25(Spring Boot plugin)
- JDK 25
- Docker (running locally) for building images
./mvnw clean verify
./mvnw spring-boot:run-
Building Image with Spring Boot Build Plugin (produces
docker.io/hendisantika/docker-without-docker:0.0.2):./mvnw clean verify spring-boot:build-image
-
Building Image with Fabric8 (produces
spring-boot-docker-without-docker:0.0.2):./mvnw clean verify -DskipTests -Pbuild-with-fabric-8
-
Building Image with JIB (produces
jib-build-spring-boot-docker-without-docker:0.0.2):./mvnw clean verify -DskipTests -Pbuild-with-jib
-
Push Image to Docker Hub:
./mvnw clean verify -DskipTests -Pdockerhub
docker run --name spring-boot-docker-without-docker -p 8080:8080 spring-boot-docker-without-docker:0.0.2The GitHub Actions workflow builds with Temurin JDK 25, builds images with all three
mechanisms, pushes a multi-arch (linux/amd64, linux/arm64) image to Docker Hub tagged with the run number, then
deploys it to the development server. It needs these repository secrets: DOCKERHUB_USERNAME, DOCKERHUB_TOKEN
(a Docker Hub personal access token with Read & Write scope) and the SSH secrets used by the deploy job.