Cache JDK downloads for tests that use ImageFromDockerfile
Update `spring-boot-launch-script-tests` and `spring-boot-loader-tests` so that JDK archives are now downloaded by Gradle and cached across builds. Closes gh-37450
This commit is contained in:
@@ -120,10 +120,11 @@ class LoaderIntegrationTests {
|
||||
}
|
||||
|
||||
static JavaRuntime oracleJdk17() {
|
||||
String arch = System.getProperty("os.arch");
|
||||
String dockerFile = ("aarch64".equals(arch)) ? "Dockerfile-aarch64" : "Dockerfile";
|
||||
ImageFromDockerfile image = new ImageFromDockerfile("spring-boot-loader/oracle-jdk-17")
|
||||
.withFileFromFile("Dockerfile", new File("src/intTest/resources/conf/oracle-jdk-17/" + dockerFile));
|
||||
ImageFromDockerfile image = new ImageFromDockerfile("spring-boot-loader/oracle-jdk");
|
||||
image.withFileFromFile("Dockerfile", new File("src/intTest/resources/conf/oracle-jdk-17/Dockerfile"));
|
||||
for (File file : new File("build/downloads/jdk/oracle").listFiles()) {
|
||||
image.withFileFromFile("downloads/" + file.getName(), file);
|
||||
}
|
||||
return new JavaRuntime("Oracle JDK 17", JavaVersion.SEVENTEEN, () -> new GenericContainer<>(image));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
FROM ubuntu:jammy-20230624 as prepare
|
||||
COPY downloads/* /opt/download/
|
||||
RUN mkdir -p /opt/jdk && \
|
||||
cd /opt/jdk && \
|
||||
tar xzf /opt/download/* --strip-components=1
|
||||
|
||||
FROM ubuntu:jammy-20230624
|
||||
RUN apt-get update && \
|
||||
apt-get install -y software-properties-common curl && \
|
||||
mkdir -p /opt/oraclejdk && \
|
||||
cd /opt/oraclejdk && \
|
||||
curl -L https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.tar.gz | tar zx --strip-components=1
|
||||
ENV JAVA_HOME /opt/oraclejdk
|
||||
COPY --from=prepare /opt/jdk /opt/jdk
|
||||
ENV JAVA_HOME /opt/jdk
|
||||
ENV PATH $JAVA_HOME/bin:$PATH
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
FROM ubuntu:jammy-20230624
|
||||
RUN apt-get update && \
|
||||
apt-get install -y software-properties-common curl && \
|
||||
mkdir -p /opt/oraclejdk && \
|
||||
cd /opt/oraclejdk && \
|
||||
curl -L https://download.oracle.com/java/17/archive/jdk-17.0.8_linux-aarch64_bin.tar.gz | tar zx --strip-components=1
|
||||
ENV JAVA_HOME /opt/oraclejdk
|
||||
ENV PATH $JAVA_HOME/bin:$PATH
|
||||
Reference in New Issue
Block a user