Skip to content

fabianlee/spring-boot-with-buildah

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spring-boot-with-buildah

Minimal Spring Boot project that shows how to use gradle and buildah to create an OCI-compatible (Docker) image, then run it with podman.

Full blog: https://fabianlee.org/2022/08/03/java-creating-oci-compatible-image-for-spring-boot-web-using-buildah/

Create OCI image with buildah

./gradlew bootJar
./gradlew buildah

Run image with podman

./gradlew podman

Validate podman image running locally

curl http://localhost:8080/info

curl -s http://localhost:8080/api/user | jq

curl -s http://localhost:8081/actuator/health | jq

Project initially created using Spring Intializer

Spring Initializer Web UI

id=spring-boot-with-buildah
artifact_id="${id//-}"
SpringAppClassName=SpringMain
version="0.0.2-SNAPSHOT"
groupId="org.fabianlee"

curl https://start.spring.io/starter.zip \
    -d type=gradle-project \
    -d dependencies=web,prometheus,devtools,actuator \
    -d javaVersion=11 \
    -d bootVersion=2.7.0 \
    -d groupId=$groupId \
    -d artifactId=$artifact_id \
    -d name=$SpringAppClassName \
    -d baseDir=$id \
    -d version=$version \
    -o $id.zip

unzip $id.zip
cd $id
chmod +x ./gradlew

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published