spring-cloud / spring-cloud-dataflow

A microservices-based Streaming and Batch data processing in Cloud Foundry and Kubernetes
https://dataflow.spring.io
Apache License 2.0
1.11k stars 583 forks source link

Spring Cloud Dataflow Docker Image with JDK 21 #5487

Open obiwan87 opened 1 year ago

obiwan87 commented 1 year ago

Problem description: There is no JDK 21 image for Spring Cloud Dataflow (https://hub.docker.com/r/springcloud/spring-cloud-dataflow-server)

Solution description: Please provide one.

Additional context: I didn't know where else to issue this request.

corneil commented 1 year ago

This can only be completed when Paketo Buildpacks support for Java 21 is released.

obiwan87 commented 1 year ago

According to https://paketo.io/docs/howto/java/ Java 21 has been added "immediately":

JVM Default Version The Java buildpack’s default version will change periodically. The Paketo buildpack will change the default version of Java once the most recently released LTS version of Java is at least one year old. For example, Java 21 will release in September 2023. It will be added to the Paketo buildpacks immediately, but will not become the default until September 2024.

corneil commented 1 year ago

According to https://paketo.io/docs/howto/java/ Java 21 has been added "immediately":

JVM Default Version The Java buildpack’s default version will change periodically. The Paketo buildpack will change the default version of Java once the most recently released LTS version of Java is at least one year old. For example, Java 21 will release in September 2023. It will be added to the Paketo buildpacks immediately, but will not become the default until September 2024.

It has been add but isn't part default build. We need to override the versions of buildpacks used in order to build a container with Java 21.

obiwan87 commented 1 year ago

Ok, so does this mean you will be able to add JDK 21 images soon? If yes, when do you think can we expect JDK 21 images?

corneil commented 1 year ago

It will propably be with 2.11.1. We have acceptance testing using Java 8, 11 and 17. We have not add Java 21 to the acceptance tests.

Creating your own requires the following steps: Download spring-cloud-dataflow-server and spring-cloud-skipper jars from Maven. Install Paketo pack Run the following with REPO=springcloud/spring-cloud-dataflow-server and springcloud/spring-cloud-skipper-server JAR=spring-cloud-dataflow-server-2.11.0.jar and spring-cloud-skipper-server-2.11.0.jar

  REPO=springcloud/spring-cloud-dataflow-server
  TAG=2.11.0
  JAR=<path to jar>\spring-cloud-dataflow-server-2.11.0.jar
  pack build --builder gcr.io/paketo-buildpacks/builder:base \
          --path "$JAR" \
          --trust-builder --verbose \
          --buildpack "paketo-buildpacks/java@10.0.0" --buildpack "paketo-buildpacks/bellsoft-liberica@10.3.2" \
          --env BP_JVM_VERSION=21 "$REPO:$TAG-jdk21"

When it is built, push to your private registry and reference your private registry from deployment scripts.

obiwan87 commented 1 year ago

Thank you! I always wondered how I could build my own images

EDIT: It worked like a charm <3

todorinskiz commented 7 months ago

We now have packeto images for JDK 21 https://github.com/paketo-buildpacks/oracle/pull/177

corneil commented 7 months ago

@todorinskiz We usually just use

JDKS="8 11 17"
for v in $JDKS; do
  pack build \
    --path "target/spring-cloud-dataflow-server-$VERSION.jar" \
    --builder gcr.io/paketo-buildpacks/builder:base \
    --env BP_JVM_VERSION=$v \
    --env BPE_APPEND_JDK_JAVA_OPTIONS=-Dfile.encoding=UTF-8 \
    --env BPE_APPEND_JDK_JAVA_OPTIONS=-Dsun.jnu.encoding \
    --env BPE_LC_ALL=en_US.utf8 \
    --env BPE_LANG=en_US.utf8 \
    "springcloud/spring-cloud-dataflow-server:$VERSION-jdk$v"
done

Adding "21" to the list fails with:


base: Pulling from paketo-buildpacks/builder
Digest: sha256:214012ca29b99a53ec653a27f4e91a5df3ea3b1a9ce8d7926a918ce7d06c18e0
Status: Image is up to date for gcr.io/paketo-buildpacks/builder:base
base-cnb: Pulling from paketo-buildpacks/run
Digest: sha256:1af9935d8987fd52b2266d288200c9482d1dd5529860bbf5bc2d248de1cb1a38
Status: Image is up to date for gcr.io/paketo-buildpacks/run:base-cnb
0.16.5: Pulling from buildpacksio/lifecycle
Digest: sha256:6328c7b662c452111e39f1f5d5d097292d07c218ba4a873f0ad0c2cb67710869
Status: Image is up to date for buildpacksio/lifecycle:0.16.5
===> ANALYZING
[analyzer] Image with name "springcloud/spring-cloud-dataflow-server:2.11.3-SNAPSHOT-jdk21" not found
===> DETECTING
[detector] 7 of 26 buildpacks participating
[detector] paketo-buildpacks/ca-certificates       3.6.3
[detector] paketo-buildpacks/bellsoft-liberica     10.2.6
[detector] paketo-buildpacks/syft                  1.32.1
[detector] paketo-buildpacks/executable-jar        6.7.4
[detector] paketo-buildpacks/dist-zip              5.6.4
[detector] paketo-buildpacks/spring-boot           5.26.1
[detector] paketo-buildpacks/environment-variables 4.5.3
===> RESTORING
===> BUILDING
[builder] 
[builder] Paketo Buildpack for CA Certificates 3.6.3
[builder]   https://github.com/paketo-buildpacks/ca-certificates
[builder]   Launch Helper: Contributing to layer
[builder]     Creating /layers/paketo-buildpacks_ca-certificates/helper/exec.d/ca-certificates-helper
[builder] 
[builder] Paketo Buildpack for BellSoft Liberica 10.2.6
[builder]   https://github.com/paketo-buildpacks/bellsoft-liberica
[builder]   Build Configuration:
[builder]     $BP_JVM_JLINK_ARGS           --no-man-pages --no-header-files --strip-debug --compress=1  configure custom link arguments (--output must be omitted)
[builder]     $BP_JVM_JLINK_ENABLED        false                                                        enables running jlink tool to generate custom JRE
[builder]     $BP_JVM_TYPE                 JRE                                                          the JVM type - JDK or JRE
[builder]     $BP_JVM_VERSION              21                                                           the Java version
[builder]   Launch Configuration:
[builder]     $BPL_DEBUG_ENABLED           false                                                        enables Java remote debugging support
[builder]     $BPL_DEBUG_PORT              8000                                                         configure the remote debugging port
[builder]     $BPL_DEBUG_SUSPEND           false                                                        configure whether to suspend execution until a debugger has attached
[builder]     $BPL_HEAP_DUMP_PATH                                                                       write heap dumps on error to this path
[builder]     $BPL_JAVA_NMT_ENABLED        true                                                         enables Java Native Memory Tracking (NMT)
[builder]     $BPL_JAVA_NMT_LEVEL          summary                                                      configure level of NMT, summary or detail
[builder]     $BPL_JFR_ARGS                                                                             configure custom Java Flight Recording (JFR) arguments
[builder]     $BPL_JFR_ENABLED             false                                                        enables Java Flight Recording (JFR)
[builder]     $BPL_JMX_ENABLED             false                                                        enables Java Management Extensions (JMX)
[builder]     $BPL_JMX_PORT                5000                                                         configure the JMX port
[builder]     $BPL_JVM_HEAD_ROOM           0                                                            the headroom in memory calculation
[builder]     $BPL_JVM_LOADED_CLASS_COUNT  35% of classes                                               the number of loaded classes in memory calculation
[builder]     $BPL_JVM_THREAD_COUNT        250                                                          the number of threads in memory calculation
[builder]     $JAVA_TOOL_OPTIONS                                                                        the JVM launch flags
[builder]     Using Java version 21 from BP_JVM_VERSION
[builder]   No valid JRE available, providing matching JDK instead. Using a JDK at runtime has security implications.
[builder]    : Contributing to layer
[builder]   Warning: Dependency has no SHA256. Skipping cache.
[builder]     Downloading from 
[builder] unable to invoke layer creator
[builder] unable to get dependency 
[builder] unable to download 
[builder] unable to request 
[builder] Get "": unsupported protocol scheme ""