From 80d0d3e45f99c522d3c1348b1bf569abce5a36cb Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Mon, 10 Jan 2022 19:20:32 +0100 Subject: [PATCH] Dockerfile: Build and run ORT with Java 17 LTS Build ORT with Java 17 LTS to benefit from newer bytecode optimizations [1] and to get rid of the bogus "illegal reflective access" warning triggered by Retrofit which caused a lot of confusion [2]. While "Alpine is not in a supported release by OpenJDK" [3], eclipse-temurin [4] (which supersedes the deprecated adoptopenjdk [5]) does offers both JRE and JDK Alpine images [6]. However, use neither of them and instead prefer to use the slightly larger "17-jdk-focal" image instead as that JDK image can also be easily used to *run* ORT in order to supersede #4178, so building and running ORT share the same image. At a later point, the effort to use "eclipse-temurin:17-jdk-alpine" for running (and building) ORT could be undertaken in order to reduce the Docker image size (see #3230). But installing all required tools and building ScanCode on Alpine could become difficult. [1]: https://github.com/oss-review-toolkit/ort/pull/4912 [2]: https://github.com/oss-review-toolkit/ort/search?q=%22illegal+reflective+access%22&type=issues [3]: https://hub.docker.com/_/openjdk [4]: https://hub.docker.com/_/eclipse-temurin [5]: https://hub.docker.com/_/adoptopenjdk [6]: https://blog.adoptium.net/2021/09/eclipse-temurin-17-available/ Signed-off-by: Sebastian Schuberth --- Dockerfile | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4278ae831ea59..94756f78af3f6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,16 +28,7 @@ ARG CRT_FILES="" # Set this to the ScanCode version to use. ARG SCANCODE_VERSION="30.1.0" -FROM adoptopenjdk/openjdk11:alpine-slim AS build - -# Apk install commands. -RUN apk add --no-cache \ - # Required for Node.js to build the reporter-web-app. - libstdc++ \ - # Required to allow to download via a proxy with a self-signed certificate. - ca-certificates \ - coreutils \ - openssl +FROM eclipse-temurin:17-jdk-focal AS build COPY . /usr/local/src/ort @@ -53,7 +44,7 @@ RUN --mount=type=cache,target=/tmp/.gradle/ \ sed -i -r '/distributionSha256Sum=[0-9a-f]{64}/d' gradle/wrapper/gradle-wrapper.properties && \ ./gradlew --no-daemon --stacktrace -Pversion=$ORT_VERSION :cli:distTar :helper-cli:startScripts -FROM adoptopenjdk:11-jre-hotspot-focal +FROM eclipse-temurin:17-jdk-focal ENV \ # Package manager versions.