2

Using Spring boot and gradle to build docker image for deploy on my K8s infrasctructure. I would like to switch from Paketo's Liberica OpenJDK distro to Adoptium's OpenJDK on the docker image. When I make the changes indicated on Paketo's site, the app builds and publishes to my repo just fine, but I still see the Liberica jdk being dropped on and used on the resultant image.

Using Spring boot 2.6.4 with all relevant dependencies at the same revision level. Using gradle 7.4.

Here is my gradle config for the bootBuildImage stanza:

bootBuildImage {
    imageName = "${dockerUrl}/${project.name}:${version}"
    publish = true
    docker {
        tlsVerify = false
        publishRegistry  {
            username = "${dockerUsername}"
            password = "${dockerPassword}"
            url = "${dockerUrl}"
            email = "${dockerEmail}"
        }
    }
    environment = [
            'BPE_DELIM_JAVA_TOOL_OPTIONS' : ' ',
            'BPE_APPEND_JAVA_TOOL_OPTIONS' : '-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8787',
            'BPE_APPEND_JAVA_TOOL_OPTIONS' : '-Duser.timezone=America/New_York'

    ]
    buildpacks = ["gcr.io/paketo-buildpacks/adoptium", "urn:cnb:builder:paketo-buildpacks/java"]
}
Bill Pfeiffer
  • 926
  • 8
  • 20
  • 1
    What you're doing looks right. You've got Adoptium before the Java buildpack. You will still see the Bellsoft Liberica buildpack run, but it shouldn't contribute anything. If that's not what you're seeing, please include the full output from building so I can see what's going on. – Daniel Mikusa Mar 15 '22 at 12:37
  • 1
    Also, FYI you don't need to set `'-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8787'` like that. The buildpack can enable/disable debug options for you. At runtime, if you set `BPL_DEBUG_ENABLED=true`, we'll automatically enable those debug options for you. If it's not set, debug options won't be enabled. See https://paketo.io/docs/howto/java/#enable-remote-debugging – Daniel Mikusa Mar 15 '22 at 12:39
  • @DanielMikusa I'm new to this buildpacks world. When you do that configuration, does it mean that you are going to do exactly everything the default builder (paketobuildpacks/builder:base) does and changing only the jvm buildpack used? – fasfsfgs May 29 '23 at 02:08

1 Answers1

2

Solved: The buildpacks values are correct in my original post. I was having an issue with my jenkins build system deploying old images so continued to see liberica jdk on those. Verified today with proper image that only the adoptium jdk layer is being written to the image and the liberica layer is not there. Upvoted responses indicating this.

Bill Pfeiffer
  • 926
  • 8
  • 20