forked from educates/educates-training-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request educates#266 from GrahamDumpleton/jdk21-environmen…
…t-image Add JDK 21 workshop base image.
- Loading branch information
Showing
18 changed files
with
154 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#syntax=docker/dockerfile:1.3-labs | ||
|
||
ARG IMAGE_REPOSITORY=localhost:5001 | ||
ARG BASE_IMAGE_NAME=educates-base-environment | ||
ARG PACKAGE_VERSION=latest | ||
|
||
FROM ${IMAGE_REPOSITORY}/${BASE_IMAGE_NAME}:${PACKAGE_VERSION} AS scratch-image | ||
|
||
ARG TARGETARCH | ||
|
||
RUN mkdir -p /opt/{java,gradle,maven} | ||
|
||
RUN <<EOF | ||
set -eo pipefail | ||
ARCHNAME_amd64=x64 | ||
ARCHNAME_arm64=aarch64 | ||
ARCHNAME=ARCHNAME_${TARGETARCH} | ||
CHECKSUM_amd64="1a6fa8abda4c5caed915cfbeeb176e7fbd12eb6b222f26e290ee45808b529aa1" | ||
CHECKSUM_arm64="e184dc29a6712c1f78754ab36fb48866583665fa345324f1a79e569c064f95e9" | ||
CHECKSUM=CHECKSUM_${TARGETARCH} | ||
curl --fail -sL -o /tmp/jdk21.tar.gz https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.1%2B12/OpenJDK21U-jdk_${!ARCHNAME}_linux_hotspot_21.0.1_12.tar.gz | ||
echo "${!CHECKSUM} /tmp/jdk21.tar.gz" | sha256sum --check --status | ||
tar -C /opt/java --strip-components 1 -zxf /tmp/jdk21.tar.gz | ||
rm /tmp/jdk21.tar.gz | ||
EOF | ||
|
||
RUN curl --fail -sL -o /tmp/maven.tar.gz https://archive.apache.org/dist/maven/maven-3/3.9.2/binaries/apache-maven-3.9.2-bin.tar.gz && \ | ||
echo "900bdeeeae550d2d2b3920fe0e00e41b0069f32c019d566465015bdd1b3866395cbe016e22d95d25d51d3a5e614af2c83ec9b282d73309f644859bbad08b63db /tmp/maven.tar.gz" | sha512sum --check --status && \ | ||
tar -C /opt/maven --strip-components 1 -zxf /tmp/maven.tar.gz && \ | ||
rm /tmp/maven.tar.gz | ||
|
||
RUN curl --fail -sL -o /tmp/gradle.zip https://services.gradle.org/distributions/gradle-8.5-bin.zip && \ | ||
echo "9d926787066a081739e8200858338b4a69e837c3a821a33aca9db09dd4a41026 /tmp/gradle.zip" | sha256sum --check --status && \ | ||
unzip -d /opt/gradle /tmp/gradle.zip && \ | ||
mv /opt/gradle/gradle-8.5/* /opt/gradle/ && \ | ||
rm -rf /opt/gradle/gradle-8.5 && \ | ||
rm /tmp/gradle.zip | ||
|
||
ENV PATH=/opt/java/bin:/opt/gradle/bin:/opt/maven/bin:$PATH \ | ||
JAVA_HOME=/opt/java \ | ||
M2_HOME=/opt/maven | ||
|
||
RUN mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app \ | ||
-DarchetypeArtifactId=maven-archetype-quickstart \ | ||
-DarchetypeVersion=1.4 -DinteractiveMode=false && \ | ||
cd my-app && \ | ||
mvn wrapper:wrapper | ||
|
||
RUN gradle init && \ | ||
gradle wrapper --gradle-version=8.5 --distribution-type=bin && \ | ||
./gradlew build | ||
|
||
FROM ${IMAGE_REPOSITORY}/${BASE_IMAGE_NAME}:${PACKAGE_VERSION} | ||
|
||
COPY --from=scratch-image --chown=1001:0 /opt/java /opt/java | ||
COPY --from=scratch-image --chown=1001:0 /opt/gradle /opt/gradle | ||
COPY --from=scratch-image --chown=1001:0 /opt/maven /opt/maven | ||
|
||
COPY --from=scratch-image --chown=1001:0 /home/eduk8s/.m2 /home/eduk8s/.m2 | ||
COPY --from=scratch-image --chown=1001:0 /home/eduk8s/.gradle /home/eduk8s/.gradle | ||
|
||
COPY --chown=1001:0 opt/. /opt/ | ||
|
||
ENV PATH=/opt/java/bin:/opt/gradle/bin:/opt/maven/bin:$PATH \ | ||
JAVA_HOME=/opt/java \ | ||
M2_HOME=/opt/maven |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
JDK21 Environment | ||
================= | ||
|
||
This directory holds the source code for the workshop JDK21 environment image. | ||
|
||
It can be used as a base image for constructing a custom workshop image which | ||
includes workshop content, or can be used as the workshop image declared in the | ||
workshop YAML definition, with workshop files pulled down from a GitHub | ||
repository when the workshop session is created. | ||
|
||
``` | ||
apiVersion: training.educates.dev/v1beta1 | ||
kind: Workshop | ||
metadata: | ||
name: lab-java-workshop | ||
spec: | ||
title: Java Testing | ||
description: Test of JDK21 environment. | ||
workshop: | ||
image: jdk21-environment:* | ||
``` |
17 changes: 17 additions & 0 deletions
17
workshop-images/jdk21-environment/opt/eduk8s/etc/setup.d/11-java.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/sh | ||
|
||
SETTINGS=$HOME/.local/share/code-server/User/settings.json | ||
|
||
jq -M '. + { | ||
"java.configuration.checkProjectSettingsExclusions": false, | ||
"java.help.firstView": "overview", | ||
"java.semanticHighlighting.enabled": false, | ||
"files.exclude": { | ||
"**/.classpath": true, | ||
"**/.project": true, | ||
"**/.settings": true, | ||
"**/.factorypath": true | ||
} | ||
}' $SETTINGS > $SETTINGS.$$ | ||
|
||
mv $SETTINGS.$$ $SETTINGS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters