Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add multiplatform docker build and support for podman as container bu… #464

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
version = "0.5.0-SNAPSHOT"
ext["jvmVersion"] = 21

val containerEngine by extra { "docker" } // or "podman"
//val containerEngine by extra { "podman" }
20 changes: 19 additions & 1 deletion buildSrc/src/main/kotlin/boudicca-springboot-app.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,28 @@ dependencies {
testImplementation(versionCatalog.findLibrary("spring-boot-starter-test").get())
}

val containerEngine: String by rootProject.extra

task<Exec>("imageBuild") {
inputs.file("src/main/docker/Dockerfile")
inputs.files(tasks.named("bootJar")) //TODO extract to own plugin
dependsOn(tasks.named("assemble"))
commandLine("docker", "build", "-t", "localhost/boudicca-${project.name}", "-f", "src/main/docker/Dockerfile", ".")
commandLine(containerEngine, "build", "-t", "localhost/boudicca-${project.name}", "-f", "src/main/docker/Dockerfile", ".")
}

task<Exec>("imageBuildMultiplatform") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mabye we should put into the name the platform actually built? and not only "multiplatform"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please also add this image build task to the eventcollectors, they sadly still have their own task because they are not a spring boot app (till now at least, something to consider in the future...)

inputs.file("src/main/docker/Dockerfile")
inputs.files(tasks.named("bootJar")) //TODO extract to own plugin
dependsOn(tasks.named("assemble"))
commandLine(
containerEngine,
"buildx",
"build",
"--platform",
"linux/amd64,linux/arm64",
"-t", "localhost/boudicca-${project.name}",
"-f", "src/main/docker/Dockerfile",
".")
}