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 gradle-oci to implementations.md #1156

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SgtSilvio
Copy link

@SgtSilvio SgtSilvio commented Jan 8, 2024

As the author of the Gradle OCI plugin I want to ask if it can be included in the list of implementations.

It is a Gradle plugin to ease using and producing (multi-arch) OCI images without requiring external tools.

The plugin allows:

Please let me know if any additional information is required.

@sudo-bmitch
Copy link
Contributor

Hi @SgtSilvio, I'm not a Java / Gradle / Kotlin dev, so this is out of my expertise. But that's not really needed to approve this. Do you have an example image created by this project on a public repo that we could review?

@SgtSilvio
Copy link
Author

SgtSilvio commented Jan 9, 2024

Thanks for your answer.
The hivemq/hivemq-swarm is a public image that has been built with gralde-oci since December. (example tag: 4.23.0).
The project source is private, but I can share the image definition below.
In short,

  • it has distroless/java11-debian11:latest as parent image and
  • adds 3 layers (called "libs", "jar" and "resources")
  • for the platforms linux/amd64 and linux/arm64/v8
Full Image Definition
oci {
    imageDefinitions.register("main") {
        allPlatforms {
            parentImages {
                add("distroless:java11-debian11:latest") { isChanging = true }
            }
            config {
                entryPoint.add("java")
                entryPoint.addAll(application.applicationDefaultJvmArgs)
                entryPoint.addAll(
                    "-XX:+UnlockExperimentalVMOptions",
                    "-XX:+UseG1GC",
                    "-XX:InitialRAMPercentage=60",
                    "-XX:MaxRAMPercentage=70",
                    "-XX:MinRAMPercentage=40",
                    "-Dswarm.home=/",
                    "-cp",
                    "/app/classpath/*:/app/libs/*",
                )
                entryPoint.add(application.mainClass)
                environment.put("LOG_LEVEL", "INFO")
            }
            layers {
                layer("libs") {
                    contents {
                        from(configurations.runtimeClasspath)
                        into("app/libs")
                    }
                }
                layer("jar") {
                    contents {
                        from(proguardJar.flatMap { it.inputOutputGroups[0].outputs[0].archiveFile })
                        into("app/classpath")
                        rename(".*", "${project.name}-${project.version}.jar")
                    }
                }
                layer("resources") {
                    contents {
                        from("src/distribution")
                        from("src/main/resources/logback.xml") { into("config") }
                        from(standardExtensions) { into("extensions") }
                        filter.exclude("config/config.xml", "scenario/scenario.xml", "**/Readme.md")
                    }
                }
            }
        }
        specificPlatform(platform("linux", "amd64"))
        specificPlatform(platform("linux", "arm64", "v8"))
    }
}

Copy link
Contributor

@sudo-bmitch sudo-bmitch left a comment

Choose a reason for hiding this comment

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

LGTM

@SgtSilvio
Copy link
Author

In addition to hivemq-swarm, the Gradle OCI plugin is now used in more places, for example:

@SgtSilvio
Copy link
Author

What is missing to get this merged?

@sudo-bmitch
Copy link
Contributor

What is missing to get this merged?

It's waiting on a second review from @opencontainers/image-spec-maintainers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants