Skip to content

Commit 353ce31

Browse files
authored
Fix Dockerfile generator for Java 11 (#2777)
* Update dockerfile-generator.sh * Update dockerfile-generator.sh * Update dockerfile-generator.sh * Update dockerfile-generator.sh * Update dockerfile-generator.sh
1 parent 9bfcc3f commit 353ce31

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

docker/dockerfile-generator.sh

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -239,14 +239,25 @@ ENV CC=gcc-7 CXX=g++-7" >> "$DOCKERFILE_PATH"
239239
printDockerJDKs() {
240240
# JDK8 uses zulu-7 to as it's bootjdk
241241
if [ "${JDK_VERSION}" != 8 ] && [ "${JDK_VERSION}" != "${JDK_MAX}" ]; then
242-
if [ ${COMMENTS} == true ]; then
243-
echo "
244-
# Extract JDK$((JDK_VERSION-1)) to use as a boot jdk" >> "$DOCKERFILE_PATH"
242+
if [ "${JDK_VERSION}" == 11 ]; then
243+
if [ ${COMMENTS} == true ]; then
244+
echo "
245+
# JDK 10 is not available on the adoptium API, extract JDK 11 to use as a boot jdk" >> "$DOCKERFILE_PATH"
246+
fi
247+
printJDK $((JDK_VERSION))
248+
echo "RUN ln -sf /usr/lib/jvm/jdk$((JDK_VERSION))/bin/java /usr/bin/java" >> "$DOCKERFILE_PATH"
249+
echo "RUN ln -sf /usr/lib/jvm/jdk$((JDK_VERSION))/bin/javac /usr/bin/javac" >> "$DOCKERFILE_PATH"
250+
echo "RUN ln -sf /usr/lib/jvm/jdk$((JDK_VERSION))/bin/keytool /usr/bin/keytool" >> "$DOCKERFILE_PATH"
251+
else
252+
if [ ${COMMENTS} == true ]; then
253+
echo "
254+
# Extract JDK$((JDK_VERSION-1)) to use as a boot jdk" >> "$DOCKERFILE_PATH"
255+
fi
256+
printJDK $((JDK_VERSION-1))
257+
echo "RUN ln -sf /usr/lib/jvm/jdk$((JDK_VERSION-1))/bin/java /usr/bin/java" >> "$DOCKERFILE_PATH"
258+
echo "RUN ln -sf /usr/lib/jvm/jdk$((JDK_VERSION-1))/bin/javac /usr/bin/javac" >> "$DOCKERFILE_PATH"
259+
echo "RUN ln -sf /usr/lib/jvm/jdk$((JDK_VERSION-1))/bin/keytool /usr/bin/keytool" >> "$DOCKERFILE_PATH"
245260
fi
246-
printJDK $((JDK_VERSION-1))
247-
echo "RUN ln -sf /usr/lib/jvm/jdk$((JDK_VERSION-1))/bin/java /usr/bin/java" >> "$DOCKERFILE_PATH"
248-
echo "RUN ln -sf /usr/lib/jvm/jdk$((JDK_VERSION-1))/bin/javac /usr/bin/javac" >> "$DOCKERFILE_PATH"
249-
echo "RUN ln -sf /usr/lib/jvm/jdk$((JDK_VERSION-1))/bin/keytool /usr/bin/keytool" >> "$DOCKERFILE_PATH"
250261
fi
251262

252263
# Build 'jdk' with the most recent GA release
@@ -277,12 +288,16 @@ printJDK() {
277288
RUN sh -c \"mkdir -p /usr/lib/jvm/jdk$JDKVersion && wget 'https://api.adoptium.net/v3/binary/latest/$JDKVersion/ga/linux/x64/jdk/hotspot/normal/adoptium?project=jdk' -O - | tar xzf - -C /usr/lib/jvm/jdk$JDKVersion --strip-components=1\"" >> "$DOCKERFILE_PATH"
278289
}
279290

291+
printGitCloneJenkinsPipelines(){
292+
echo "
293+
RUN git clone https://github.com/adoptium/ci-jenkins-pipelines /openjdk/pipelines" >> "$DOCKERFILE_PATH"
294+
}
295+
280296
printCopyFolders(){
281297
echo "
282298
COPY sbin /openjdk/sbin
283299
COPY security /openjdk/security
284-
COPY workspace/config /openjdk/config
285-
COPY pipelines /openjdk/pipelines" >> "$DOCKERFILE_PATH"
300+
COPY workspace/config /openjdk/config" >> "$DOCKERFILE_PATH"
286301
}
287302

288303
printGitClone(){
@@ -345,6 +360,7 @@ if [ ${OPENJ9} == true ]; then
345360
fi
346361

347362
printDockerJDKs
363+
printGitCloneJenkinsPipelines
348364

349365
# If building the image straight away, it can't be assumed the folders to be copied are in place
350366
# Therefore create an image that instead git clones openjdk-build and a build can be started there

0 commit comments

Comments
 (0)