• pom.xml
<properties>
  <module.image.name>asimio/${project.name}</module.image.name>
...
</properties>

<build>
  <plugins>
    <plugin>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-maven-plugin</artifactId>
      <configuration>
        <excludeDevtools>false</excludeDevtools>
        <imageName>${module.image.name}</imageName>
      </configuration>
    </plugin>
...
</build>
...


  • Start a Docker daemon, either local or in a remote Docker host

  • Use spring-boot:build-image or spring-boot:build-image-no-fork


spring-boot:build-image

mvn spring-boot:build-image -Dmodule.image.name=ghcr.io/asimio/springboot3-thymeleaf-themes-layouts-fragments
[INFO] Scanning for projects...
[INFO]
[INFO] --< com.asimiotech.demo:springboot3-thymeleaf-themes-layouts-fragments >--
[INFO] Building springboot3-thymeleaf-themes-layouts-fragments 0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
...
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.asimiotech.demo.web.controller.HomeControllerExternalLayoutsIntegrationTest
...
[INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.055 s -- in com.asimiotech.demo.web.controller.HomeControllerIntegrationTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 7, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- maven-jar-plugin:3.4.2:jar (default-jar) @ springboot3-thymeleaf-themes-layouts-fragments ---
[INFO] Building jar: /Users/ootero/Projects/bitbucket.org/springboot3-thymeleaf-themes-layouts-fragments/target/springboot3-thymeleaf-themes-layouts-fragments-0-SNAPSHOT.jar
...
[INFO] --- spring-boot-maven-plugin:3.3.10:build-image (default-cli) @ springboot3-thymeleaf-themes-layouts-fragments ---
[INFO] Building image 'ghcr.io/asimio/springboot3-thymeleaf-themes-layouts-fragments:latest'
...
[INFO] Successfully built image 'ghcr.io/asimio/springboot3-thymeleaf-themes-layouts-fragments:latest'
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  04:12 min
[INFO] Finished at: 2025-08-08T10:23:55-04:00
[INFO] ------------------------------------------------------------------------


spring-boot:build-image-no-fork

mvn clean package
...
mvn spring-boot:build-image-no-fork -Dmodule.image.name=ghcr.io/asimio/springboot3-thymeleaf-themes-layouts-fragments
...


  • Publish the Docker/OCI image to GHCR
    • Add to your local bash profile file (eg ~/.bash_profile):
      export CR_PAT=<your github_container_registry_personal_access_token>

    • echo $CR_PAT | docker login ghcr.io -u <github_username> --password-stdin

    • docker push ghcr.io/asimio/springboot3-thymeleaf-themes-layouts-fragments