Skip to content

Commit

Permalink
Dockerfile: Build and run ORT with Java 17 LTS
Browse files Browse the repository at this point in the history
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]: #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 <sebastian.schuberth@bosch.io>
  • Loading branch information
sschuberth committed Jan 12, 2022
1 parent 60a493b commit 80d0d3e
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.
Expand Down

0 comments on commit 80d0d3e

Please sign in to comment.