-
Notifications
You must be signed in to change notification settings - Fork 977
feat: Use Java 25 in Besu docker image #9367
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
base: main
Are you sure you want to change the base?
Changes from all commits
88823aa
9c45613
13e6ba4
ece66fa
85adc5a
3c0b1ac
d081a82
7aa05f0
09ec6b5
c25e8d2
9f98f4f
dd4d9de
fd8a473
7a75ba7
0869c7a
b3d162d
24fc95e
48a448b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -33,15 +33,12 @@ set APP_HOME=%DIRNAME%${appHomeRelativePath} | |||||
| @rem Resolve any "." and ".." in APP_HOME to make it shorter. | ||||||
| for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi | ||||||
|
|
||||||
| @rem Add default JVM options here. You can also use JAVA_OPTS and ${optsEnvironmentVar} to pass JVM options to this script. | ||||||
| set DEFAULT_JVM_OPTS=${defaultJvmOpts} | ||||||
|
|
||||||
| @rem Find java.exe | ||||||
| if defined JAVA_HOME goto findJavaFromJavaHome | ||||||
|
|
||||||
| set JAVA_EXE=java.exe | ||||||
| %JAVA_EXE% -version >NUL 2>&1 | ||||||
| if "%ERRORLEVEL%" == "0" goto execute | ||||||
| if "%ERRORLEVEL%" == "0" goto detectJavaVersion | ||||||
|
|
||||||
| echo. | ||||||
| echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. | ||||||
|
|
@@ -55,7 +52,7 @@ goto fail | |||||
| set JAVA_HOME=%JAVA_HOME:"=% | ||||||
| set JAVA_EXE=%JAVA_HOME%/bin/java.exe | ||||||
|
|
||||||
| if exist "%JAVA_EXE%" goto execute | ||||||
| if exist "%JAVA_EXE%" goto detectJavaVersion | ||||||
|
|
||||||
| echo. | ||||||
| echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% | ||||||
|
|
@@ -65,9 +62,40 @@ echo location of your Java installation. | |||||
|
|
||||||
| goto fail | ||||||
|
|
||||||
| :detectJavaVersion | ||||||
| @rem Detect Java version | ||||||
| for /f "tokens=3" %%g in ('"%JAVA_EXE%" -version 2^>^&1 ^| findstr /i "version"') do ( | ||||||
| set JAVA_VERSION_STRING=%%g | ||||||
| ) | ||||||
| set JAVA_VERSION_STRING=%JAVA_VERSION_STRING:"=% | ||||||
|
|
||||||
| @rem Extract major version (handle both 1.8 and 11+ format) | ||||||
| for /f "delims=. tokens=1-2" %%v in ("%JAVA_VERSION_STRING%") do ( | ||||||
| if "%%v"=="1" ( | ||||||
| set JAVA_VERSION=%%w | ||||||
| ) else ( | ||||||
| set JAVA_VERSION=%%v | ||||||
| ) | ||||||
| ) | ||||||
|
|
||||||
| @rem Validate Java version | ||||||
| if not defined JAVA_VERSION ( | ||||||
| echo Unable to determine Java version | ||||||
| goto fail | ||||||
| ) | ||||||
|
|
||||||
| @rem Add default JVM options here. You can also use JAVA_OPTS and ${optsEnvironmentVar} to pass JVM options to this script. | ||||||
| if %JAVA_VERSION% GEQ 25 ( | ||||||
| set DEFAULT_JVM_OPTS=@DEFAULT_JVM_OPTS_25@ | ||||||
| ) else if %JAVA_VERSION% GEQ 21 ( | ||||||
| set DEFAULT_JVM_OPTS=${defaultJvmOpts} | ||||||
|
||||||
| set DEFAULT_JVM_OPTS=${defaultJvmOpts} | |
| set DEFAULT_JVM_OPTS=@DEFAULT_JVM_OPTS_21@ |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,3 +1,9 @@ | ||||||
| # syntax=docker/dockerfile:1 | ||||||
|
|
||||||
| # Stage: Use Eclipse Temurin JRE | ||||||
| FROM eclipse-temurin:25-jre AS java-base | ||||||
|
|
||||||
| # Stage: Final Besu image | ||||||
| FROM ubuntu:24.04 | ||||||
| ARG VERSION="dev" | ||||||
| ENV NO_PROXY_CACHE="-o Acquire::BrokenProxy=true -o Acquire::http::No-Cache=true -o Acquire::http::Pipeline-Depth=0" | ||||||
|
|
@@ -6,23 +12,25 @@ ENV NO_PROXY_CACHE="-o Acquire::BrokenProxy=true -o Acquire::http::No-Cache=true | |||||
| RUN apt-get update $NO_PROXY_CACHE && \ | ||||||
| # $NO_PROXY_CACHE must not be used here or otherwise will trigger a hadolint error | ||||||
| apt-get -o Acquire::BrokenProxy=true -o Acquire::http::No-Cache=true -o Acquire::http::Pipeline-Depth=0 \ | ||||||
| --no-install-recommends -q --assume-yes install openjdk-21-jre-headless=21* libjemalloc-dev=5.* adduser=3* && \ | ||||||
| --no-install-recommends -q --assume-yes install libjemalloc-dev=5.* && \ | ||||||
| # Clean apt cache | ||||||
| apt-get clean && \ | ||||||
| rm -rf /var/cache/apt/archives/* /var/cache/apt/archives/partial/* && \ | ||||||
| rm -rf /var/lib/apt/lists/* && \ | ||||||
| # Starting from version 23.10, Ubuntu comes with an "ubuntu" user with uid 1000. We need 1000 for besu. | ||||||
| userdel ubuntu 2>/dev/null || true && rm -rf /home/ubuntu && \ | ||||||
| # Ensure we use a stable UID for besu, as file permissions are tied to UIDs. | ||||||
| adduser --uid 1000 --disabled-password --gecos "" --home /opt/besu besu && \ | ||||||
| useradd --uid 1000 --create-home --home-dir /opt/besu --shell /bin/bash besu && \ | ||||||
|
||||||
| useradd --uid 1000 --create-home --home-dir /opt/besu --shell /bin/bash besu && \ | |
| adduser --uid 1000 --home /opt/besu --shell /bin/bash --disabled-password --gecos "" besu && \ |
Copilot
AI
Oct 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Adding quotes around environment variable values is inconsistent with the previous unquoted style and unnecessary for simple values. While functionally equivalent, this creates inconsistency in the Dockerfile's style. Consider keeping the original unquoted format unless there's a specific reason for the change.
| ENV BESU_GRAPHQL_HTTP_HOST="0.0.0.0" | |
| ENV BESU_GRAPHQL_HTTP_HOST=0.0.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The placeholder
@DEFAULT_JVM_OPTS_25@uses a different format than${defaultJvmOpts}. This inconsistency in placeholder syntax could indicate a template processing issue or incomplete implementation. Verify that both placeholders are correctly replaced during the build process.