Skip to content

Commit

Permalink
feat: Add GraalVM images (#446)
Browse files Browse the repository at this point in the history
* Add GraalVM images

This PR adds images that use GraalVM Community and Oracle GraalVM for JDK 17 and 21.

Fixes #242

---------

Co-authored-by: Carlos Sanchez <carlos@apache.org>
  • Loading branch information
alvarosanchez and carlossg authored Feb 8, 2024
1 parent a054476 commit af21ec0
Show file tree
Hide file tree
Showing 12 changed files with 233 additions and 20 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/graalvm-community-17.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: graalvm-community-17

on:
push:
branches:
- main
paths:
- "graalvm-community-17/**"
- .github/workflows/graalvm-community-17.yml
- .github/workflows/_template.yml
- common.sh
- tags-for-dir.sh
- "tests/**"
- "!tests/*.ps*"
- "!tests/*.windows"
pull_request:
paths:
- "graalvm-community-17/**"
- .github/workflows/graalvm-community-17.yml
- .github/workflows/_template.yml
- common.sh
- tags-for-dir.sh
- "tests/**"
- "!tests/*.ps*"
- "!tests/*.windows"

jobs:
build:
uses: ./.github/workflows/_template.yml
with:
directory: graalvm-community-17
secrets: inherit
32 changes: 32 additions & 0 deletions .github/workflows/graalvm-community-21.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: graalvm-community-21

on:
push:
branches:
- main
paths:
- "graalvm-community-21/**"
- .github/workflows/graalvm-community-21.yml
- .github/workflows/_template.yml
- common.sh
- tags-for-dir.sh
- "tests/**"
- "!tests/*.ps*"
- "!tests/*.windows"
pull_request:
paths:
- "graalvm-community-21/**"
- .github/workflows/graalvm-community-21.yml
- .github/workflows/_template.yml
- common.sh
- tags-for-dir.sh
- "tests/**"
- "!tests/*.ps*"
- "!tests/*.windows"

jobs:
build:
uses: ./.github/workflows/_template.yml
with:
directory: graalvm-community-21
secrets: inherit
32 changes: 32 additions & 0 deletions .github/workflows/oracle-graalvm-17.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: oracle-graalvm-17

on:
push:
branches:
- main
paths:
- "oracle-graalvm-17/**"
- .github/workflows/oracle-graalvm-17.yml
- .github/workflows/_template.yml
- common.sh
- tags-for-dir.sh
- "tests/**"
- "!tests/*.ps*"
- "!tests/*.windows"
pull_request:
paths:
- "oracle-graalvm-17/**"
- .github/workflows/oracle-graalvm-17.yml
- .github/workflows/_template.yml
- common.sh
- tags-for-dir.sh
- "tests/**"
- "!tests/*.ps*"
- "!tests/*.windows"

jobs:
build:
uses: ./.github/workflows/_template.yml
with:
directory: oracle-graalvm-17
secrets: inherit
32 changes: 32 additions & 0 deletions .github/workflows/oracle-graalvm-21.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: oracle-graalvm-21

on:
push:
branches:
- main
paths:
- "oracle-graalvm-21/**"
- .github/workflows/oracle-graalvm-21.yml
- .github/workflows/_template.yml
- common.sh
- tags-for-dir.sh
- "tests/**"
- "!tests/*.ps*"
- "!tests/*.windows"
pull_request:
paths:
- "oracle-graalvm-21/**"
- .github/workflows/oracle-graalvm-21.yml
- .github/workflows/_template.yml
- common.sh
- tags-for-dir.sh
- "tests/**"
- "!tests/*.ps*"
- "!tests/*.windows"

jobs:
build:
uses: ./.github/workflows/_template.yml
with:
directory: oracle-graalvm-21
secrets: inherit
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ Only under `csanchez/maven` and `ghcr.io/carlossg/maven`:
* [azulzulu-17-alpine](https://github.com/carlossg/docker-maven/blob/main/azulzulu-17-alpine/Dockerfile)
* [azulzulu-21](https://github.com/carlossg/docker-maven/blob/main/azulzulu-21/Dockerfile)
* [azulzulu-21-alpine](https://github.com/carlossg/docker-maven/blob/main/azulzulu-21-alpine/Dockerfile)
* [graalvm-community-17](https://github.com/carlossg/docker-maven/blob/main/graalvm-community-17/)
* [graalvm-community-21](https://github.com/carlossg/docker-maven/blob/main/graalvm-community-21/)
* [libericaopenjdk-11](https://github.com/carlossg/docker-maven/blob/main/libericaopenjdk-11/Dockerfile)
* [libericaopenjdk-11-alpine](https://github.com/carlossg/docker-maven/blob/main/libericaopenjdk-11-alpine/Dockerfile)
* [libericaopenjdk-17](https://github.com/carlossg/docker-maven/blob/main/libericaopenjdk-17/Dockerfile)
Expand All @@ -73,6 +75,8 @@ Only under `csanchez/maven` and `ghcr.io/carlossg/maven`:
* [microsoft-openjdk-11-ubuntu](https://github.com/carlossg/docker-maven/blob/main/microsoft-openjdk-11-ubuntu/Dockerfile)
* [microsoft-openjdk-17-ubuntu](https://github.com/carlossg/docker-maven/blob/main/microsoft-openjdk-17-ubuntu/Dockerfile)
* [microsoft-openjdk-21-ubuntu](https://github.com/carlossg/docker-maven/blob/main/microsoft-openjdk-21-ubuntu/Dockerfile)
* [oracle-graalvm-17](https://github.com/carlossg/docker-maven/blob/main/oracle-graalvm-17/)
* [oracle-graalvm-21](https://github.com/carlossg/docker-maven/blob/main/oracle-graalvm-21/)

## Windows Based Images

Expand Down Expand Up @@ -233,6 +237,8 @@ Some come from the parent images and some are installed in this image for backwa
| eclipse-temurin-17-focal | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | |
| eclipse-temurin-21 | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | |
| eclipse-temurin-21-alpine | | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | |
| graalvm-community-17 | | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | |
| graalvm-community-21 | | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | ✔️ | |
| ibm-semeru-11-focal | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | |
| ibm-semeru-17-focal | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | |
| ibm-semeru-21-jammy | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | |
Expand All @@ -249,6 +255,8 @@ Some come from the parent images and some are installed in this image for backwa
| microsoft-openjdk-11-ubuntu | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | |
| microsoft-openjdk-17-ubuntu | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | |
| microsoft-openjdk-21-ubuntu | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | |
| oracle-graalvm-17 | | ✔️ | ✔️ | ✔️ | | ✔️ | | ✔️ | |
| oracle-graalvm-21 | | ✔️ | ✔️ | ✔️ | | ✔️ | | ✔️ | |
| sapmachine-11 | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | |
| sapmachine-17 | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | |
| sapmachine-21 | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | |
Expand Down Expand Up @@ -313,8 +321,8 @@ Pester comes with most modern Windows (Windows 10 and Windows Server 2019), but

* Copy an existing dir (other than `eclipse-temurin-11`) to the new name and update `Dockerfile` as needed.
* Update `README.md` to include the new image and table with packages installed in that image.
* Run `github-action-generation.sh` to generate new GitHub Actions for the new image
* When adding a new JDK then it also needs to be added to the beginning of `common.sh`
* Run `github-action-generation.sh` to generate new GitHub Actions for the new image
* When a parent image changes the `latest` tag to a new JDK version it can be updated in `common.sh`

## Updating Maven version
Expand Down
6 changes: 4 additions & 2 deletions common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ latest='21'
default_jdk=eclipse-temurin

# All the JDKs and their 'latest' tags
parent_images=(openjdk eclipse-temurin ibmjava ibm-semeru amazoncorretto libericaopenjdk sapmachine)
parent_images=(openjdk eclipse-temurin ibmjava ibm-semeru amazoncorretto libericaopenjdk sapmachine graalvm-community oracle-graalvm)
declare -A jdk_latest=(
["jdk"]="17"
["openjdk"]=""
Expand All @@ -18,6 +18,8 @@ declare -A jdk_latest=(
["amazoncorretto"]="11"
["libericaopenjdk"]="17"
["sapmachine"]="21"
["graalvm-community"]="21"
["oracle-graalvm"]="21"
)

# Variants of the JDKs and their 'latest' tag
Expand All @@ -29,7 +31,7 @@ declare -A extra_tags=(
)

# All the directories that have images
all_dirs=(openjdk-* eclipse-temurin-* ibmjava-* ibm-semeru-* amazoncorretto-* azulzulu-* libericaopenjdk-* microsoft-* sapmachine-*)
all_dirs=(openjdk-* eclipse-temurin-* ibmjava-* ibm-semeru-* amazoncorretto-* azulzulu-* libericaopenjdk-* microsoft-* sapmachine-* graalvm-community-* oracle-graalvm-*)

######################################################################################################################################

Expand Down
24 changes: 11 additions & 13 deletions generate-stackbrew-library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,15 @@ echo "GitRepo: $url"
echo 'GitFetch: refs/heads/main'

for version in "${all_dirs[@]}"; do
# ignore images that can't be official
if grep -q "FROM mcr.microsoft.com" "$version/Dockerfile"; then
continue
fi
# ignore all windows images
if grep -q "FROM .*windows" "$version/Dockerfile"; then
continue
fi
if [[ "$version" != azulzulu* ]] && [[ "$version" != liberica* ]]; then
branch=main
mapfile -t versionAliases < <(version-aliases "$version" "$branch")
generate-version "$version" "$branch" "${versionAliases[@]}"
fi
# ignore images that can't be official and windows
ignore_from=(".*windows" "container-registry.oracle.com" "ghcr.io" "mcr.microsoft.com" "azul/" "bellsoft/")
for ignore in "${ignore_from[@]}"; do
if grep -q "FROM $ignore" "$version/Dockerfile"; then
continue 2
fi
done

branch=main
mapfile -t versionAliases < <(version-aliases "$version" "$branch")
generate-version "$version" "$branch" "${versionAliases[@]}"
done
17 changes: 17 additions & 0 deletions graalvm-community-17/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM ghcr.io/graalvm/graalvm-community:17

# common for all images
ENV MAVEN_HOME /usr/share/maven

COPY --from=maven:3.9.6-eclipse-temurin-11 ${MAVEN_HOME} ${MAVEN_HOME}
COPY --from=maven:3.9.6-eclipse-temurin-11 /usr/local/bin/mvn-entrypoint.sh /usr/local/bin/mvn-entrypoint.sh
COPY --from=maven:3.9.6-eclipse-temurin-11 /usr/share/maven/ref/settings-docker.xml /usr/share/maven/ref/settings-docker.xml

RUN ln -s ${MAVEN_HOME}/bin/mvn /usr/bin/mvn

ARG MAVEN_VERSION=3.9.6
ARG USER_HOME_DIR="/root"
ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"

ENTRYPOINT ["/usr/local/bin/mvn-entrypoint.sh"]
CMD ["mvn"]
17 changes: 17 additions & 0 deletions graalvm-community-21/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM ghcr.io/graalvm/graalvm-community:21

# common for all images
ENV MAVEN_HOME /usr/share/maven

COPY --from=maven:3.9.6-eclipse-temurin-11 ${MAVEN_HOME} ${MAVEN_HOME}
COPY --from=maven:3.9.6-eclipse-temurin-11 /usr/local/bin/mvn-entrypoint.sh /usr/local/bin/mvn-entrypoint.sh
COPY --from=maven:3.9.6-eclipse-temurin-11 /usr/share/maven/ref/settings-docker.xml /usr/share/maven/ref/settings-docker.xml

RUN ln -s ${MAVEN_HOME}/bin/mvn /usr/bin/mvn

ARG MAVEN_VERSION=3.9.6
ARG USER_HOME_DIR="/root"
ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"

ENTRYPOINT ["/usr/local/bin/mvn-entrypoint.sh"]
CMD ["mvn"]
19 changes: 19 additions & 0 deletions oracle-graalvm-17/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM container-registry.oracle.com/graalvm/native-image:17

RUN microdnf --refresh -y install findutils

# common for all images
ENV MAVEN_HOME /usr/share/maven

COPY --from=maven:3.9.6-eclipse-temurin-11 ${MAVEN_HOME} ${MAVEN_HOME}
COPY --from=maven:3.9.6-eclipse-temurin-11 /usr/local/bin/mvn-entrypoint.sh /usr/local/bin/mvn-entrypoint.sh
COPY --from=maven:3.9.6-eclipse-temurin-11 /usr/share/maven/ref/settings-docker.xml /usr/share/maven/ref/settings-docker.xml

RUN ln -s ${MAVEN_HOME}/bin/mvn /usr/bin/mvn

ARG MAVEN_VERSION=3.9.6
ARG USER_HOME_DIR="/root"
ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"

ENTRYPOINT ["/usr/local/bin/mvn-entrypoint.sh"]
CMD ["mvn"]
19 changes: 19 additions & 0 deletions oracle-graalvm-21/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM container-registry.oracle.com/graalvm/native-image:21

RUN microdnf --refresh -y install findutils

# common for all images
ENV MAVEN_HOME /usr/share/maven

COPY --from=maven:3.9.6-eclipse-temurin-11 ${MAVEN_HOME} ${MAVEN_HOME}
COPY --from=maven:3.9.6-eclipse-temurin-11 /usr/local/bin/mvn-entrypoint.sh /usr/local/bin/mvn-entrypoint.sh
COPY --from=maven:3.9.6-eclipse-temurin-11 /usr/share/maven/ref/settings-docker.xml /usr/share/maven/ref/settings-docker.xml

RUN ln -s ${MAVEN_HOME}/bin/mvn /usr/bin/mvn

ARG MAVEN_VERSION=3.9.6
ARG USER_HOME_DIR="/root"
ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"

ENTRYPOINT ["/usr/local/bin/mvn-entrypoint.sh"]
CMD ["mvn"]
13 changes: 9 additions & 4 deletions tests/tests.bats
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ base_image=eclipse-temurin-11
[[ "$SUT_TAG" == "amazoncorretto-"* ]] ||
[[ "$SUT_TAG" == "azulzulu-"* ]] ||
[[ "$SUT_TAG" == "ibmjava-"* ]] ||
[[ "$SUT_TAG" == "libericaopenjdk-"* ]]
[[ "$SUT_TAG" == "libericaopenjdk-"* ]] ||
[[ "$SUT_TAG" == *"graalvm"* ]]
); then
[ $status -eq 0 ]
else
Expand Down Expand Up @@ -116,7 +117,8 @@ base_image=eclipse-temurin-11
if ! (
[[ "$SUT_TAG" == libericaopenjdk-? ]] ||
[[ "$SUT_TAG" == libericaopenjdk-?? ]] ||
[[ "$SUT_TAG" == openjdk-?? ]]
[[ "$SUT_TAG" == openjdk-?? ]] ||
[[ "$SUT_TAG" == *"oracle"* ]]
); then
[ $status -eq 0 ]
else
Expand All @@ -134,7 +136,9 @@ base_image=eclipse-temurin-11
if ! (
[[ "$SUT_TAG" == "amazoncorretto-"* ]] ||
[[ "$SUT_TAG" == libericaopenjdk-*-debian ]] ||
[[ "$SUT_TAG" == openjdk-?? ]]
[[ "$SUT_TAG" == openjdk-?? ]] ||
[[ "$SUT_TAG" == *"graalvm"* ]]

); then
[ $status -eq 0 ]

Expand All @@ -151,7 +155,8 @@ base_image=eclipse-temurin-11
[[ "$SUT_TAG" == amazoncorretto-*-al2023 ]] ||
[[ "$SUT_TAG" == libericaopenjdk-? ]] ||
[[ "$SUT_TAG" == libericaopenjdk-?? ]] ||
[[ "$SUT_TAG" == openjdk-?? ]]
[[ "$SUT_TAG" == openjdk-?? ]] ||
[[ "$SUT_TAG" == *"graalvm"* ]]
); then
[ $status -eq 0 ]
else
Expand Down

0 comments on commit af21ec0

Please sign in to comment.