Skip to content

Commit

Permalink
Add images with GraalVM installed (closes #253)
Browse files Browse the repository at this point in the history
  • Loading branch information
keeganwitt committed Aug 8, 2023
1 parent 2ba8422 commit 21d137b
Show file tree
Hide file tree
Showing 4 changed files with 268 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
version: [8-jdk-jammy, 8-jdk-focal, 11-jdk-jammy, 11-jdk-focal, 11-jdk-alpine, 17-jdk-jammy, 17-jdk-focal, 17-jdk-alpine, 20-jdk-jammy, 20-jdk-alpine]
version: [jdk11, jdk11-alpine, jdk11-focal, jdk17, jdk17-alpine, jdk17-focal, jdk20, jdk20-alpine, jdk17-graal, jdk17-focal-graal, jdk20-graal]
steps:
- name: checkout
uses: actions/checkout@v2
- name: build
env:
version: ${{ matrix.version }}
run: |
directory=$(echo "jdk${version}" | sed 's/-jdk//' | sed 's/-jammy//')
cd "${directory}"
docker pull "eclipse-temurin:${version}"
cd "${version}"
baseImage=$(grep "FROM " Dockerfile | cut -d' ' -f2)
docker pull "${baseImage}"
docker build --tag "gradle:${version}" .
- name: test
env:
Expand Down
88 changes: 88 additions & 0 deletions jdk17-focal-graal/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
FROM ubuntu:focal

CMD ["gradle"]

ENV GRADLE_HOME /opt/gradle

RUN set -o errexit -o nounset \
&& echo "Adding gradle user and group" \
&& groupadd --system --gid 1000 gradle \
&& useradd --system --gid gradle --uid 1000 --shell /bin/bash --create-home gradle \
&& mkdir /home/gradle/.gradle \
&& chown --recursive gradle:gradle /home/gradle \
\
&& echo "Symlinking root Gradle cache to gradle Gradle cache" \
&& ln --symbolic /home/gradle/.gradle /root/.gradle

VOLUME /home/gradle/.gradle

WORKDIR /home/gradle

RUN set -o errexit -o nounset \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
&& apt-get install --yes --no-install-recommends \
binutils \
ca-certificates \
curl \
fontconfig \
locales \
p11-kit \
tzdata \
unzip \
wget \
\
bzr \
git \
git-lfs \
mercurial \
openssh-client \
subversion \
&& rm --recursive --force /var/lib/apt/lists/* \
\
&& echo "Testing VCSes" \
&& which bzr \
&& which git \
&& which git-lfs \
&& which hg \
&& which svn

ENV JAVA_HOME=/opt/graalvm
ARG TARGETPLATFORM
RUN set -o errexit -o nounset \
&& echo "Installing GraalVM" \
&& JDK_BUILD=17.0.8 \
&& GRAALVM_PKG=https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-${JDK_BUILD}/graalvm-community-jdk-${JDK_BUILD}_GRAALVM_ARCH_bin.tar.gz \
&& if [ "${TARGETPLATFORM}" = "linux/amd64" ]; then GRAALVM_PKG=$(echo "${GRAALVM_PKG}" | sed "s/GRAALVM_ARCH/linux-x64/"); fi \
&& if [ "${TARGETPLATFORM}" = "linux/arm64" ]; then GRAALVM_PKG=$(echo "${GRAALVM_PKG}" | sed "s/GRAALVM_ARCH/linux-aarch64/"); fi \
&& curl --fail --silent --location --retry 3 ${GRAALVM_PKG} | gunzip | tar x -C /opt/ \
&& mv /opt/graalvm-* "${JAVA_HOME}" \
&& for bin in "$JAVA_HOME/bin/"*; do \
base="$(basename "$bin")"; \
[ ! -e "/usr/bin/$base" ]; \
update-alternatives --install "/usr/bin/${base}" "${base}" "${bin}" 1; \
done \
\
&& echo "Testing GraalVM installation" \
&& java --version \
&& javac --version \
&& gu --version \
&& native-image --version

ENV GRADLE_VERSION 8.2.1
ARG GRADLE_DOWNLOAD_SHA256=03ec176d388f2aa99defcadc3ac6adf8dd2bce5145a129659537c0874dea5ad1
RUN set -o errexit -o nounset \
&& echo "Downloading Gradle" \
&& wget --no-verbose --output-document=gradle.zip "https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip" \
\
&& echo "Checking download hash" \
&& echo "${GRADLE_DOWNLOAD_SHA256} *gradle.zip" | sha256sum --check - \
\
&& echo "Installing Gradle" \
&& unzip gradle.zip \
&& rm gradle.zip \
&& mv "gradle-${GRADLE_VERSION}" "${GRADLE_HOME}/" \
&& ln --symbolic "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle \
\
&& echo "Testing Gradle installation" \
&& gradle --version
88 changes: 88 additions & 0 deletions jdk17-graal/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
FROM ubuntu:jammy

CMD ["gradle"]

ENV GRADLE_HOME /opt/gradle

RUN set -o errexit -o nounset \
&& echo "Adding gradle user and group" \
&& groupadd --system --gid 1000 gradle \
&& useradd --system --gid gradle --uid 1000 --shell /bin/bash --create-home gradle \
&& mkdir /home/gradle/.gradle \
&& chown --recursive gradle:gradle /home/gradle \
\
&& echo "Symlinking root Gradle cache to gradle Gradle cache" \
&& ln --symbolic /home/gradle/.gradle /root/.gradle

VOLUME /home/gradle/.gradle

WORKDIR /home/gradle

RUN set -o errexit -o nounset \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
&& apt-get install --yes --no-install-recommends \
binutils \
ca-certificates \
curl \
fontconfig \
locales \
p11-kit \
tzdata \
unzip \
wget \
\
bzr \
git \
git-lfs \
mercurial \
openssh-client \
subversion \
&& rm --recursive --force /var/lib/apt/lists/* \
\
&& echo "Testing VCSes" \
&& which bzr \
&& which git \
&& which git-lfs \
&& which hg \
&& which svn

ENV JAVA_HOME=/opt/graalvm
ARG TARGETPLATFORM
RUN set -o errexit -o nounset \
&& echo "Installing GraalVM" \
&& JDK_BUILD=17.0.8 \
&& GRAALVM_PKG=https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-${JDK_BUILD}/graalvm-community-jdk-${JDK_BUILD}_GRAALVM_ARCH_bin.tar.gz \
&& if [ "${TARGETPLATFORM}" = "linux/amd64" ]; then GRAALVM_PKG=$(echo "${GRAALVM_PKG}" | sed "s/GRAALVM_ARCH/linux-x64/"); fi \
&& if [ "${TARGETPLATFORM}" = "linux/arm64" ]; then GRAALVM_PKG=$(echo "${GRAALVM_PKG}" | sed "s/GRAALVM_ARCH/linux-aarch64/"); fi \
&& curl --fail --silent --location --retry 3 ${GRAALVM_PKG} | gunzip | tar x -C /opt/ \
&& mv /opt/graalvm-* "${JAVA_HOME}" \
&& for bin in "$JAVA_HOME/bin/"*; do \
base="$(basename "$bin")"; \
[ ! -e "/usr/bin/$base" ]; \
update-alternatives --install "/usr/bin/${base}" "${base}" "${bin}" 1; \
done \
\
&& echo "Testing GraalVM installation" \
&& java --version \
&& javac --version \
&& gu --version \
&& native-image --version

ENV GRADLE_VERSION 8.2.1
ARG GRADLE_DOWNLOAD_SHA256=03ec176d388f2aa99defcadc3ac6adf8dd2bce5145a129659537c0874dea5ad1
RUN set -o errexit -o nounset \
&& echo "Downloading Gradle" \
&& wget --no-verbose --output-document=gradle.zip "https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip" \
\
&& echo "Checking download hash" \
&& echo "${GRADLE_DOWNLOAD_SHA256} *gradle.zip" | sha256sum --check - \
\
&& echo "Installing Gradle" \
&& unzip gradle.zip \
&& rm gradle.zip \
&& mv "gradle-${GRADLE_VERSION}" "${GRADLE_HOME}/" \
&& ln --symbolic "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle \
\
&& echo "Testing Gradle installation" \
&& gradle --version
88 changes: 88 additions & 0 deletions jdk20-graal/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
FROM ubuntu:jammy

CMD ["gradle"]

ENV GRADLE_HOME /opt/gradle

RUN set -o errexit -o nounset \
&& echo "Adding gradle user and group" \
&& groupadd --system --gid 1000 gradle \
&& useradd --system --gid gradle --uid 1000 --shell /bin/bash --create-home gradle \
&& mkdir /home/gradle/.gradle \
&& chown --recursive gradle:gradle /home/gradle \
\
&& echo "Symlinking root Gradle cache to gradle Gradle cache" \
&& ln --symbolic /home/gradle/.gradle /root/.gradle

VOLUME /home/gradle/.gradle

WORKDIR /home/gradle

RUN set -o errexit -o nounset \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
&& apt-get install --yes --no-install-recommends \
binutils \
ca-certificates \
curl \
fontconfig \
locales \
p11-kit \
tzdata \
unzip \
wget \
\
bzr \
git \
git-lfs \
mercurial \
openssh-client \
subversion \
&& rm --recursive --force /var/lib/apt/lists/* \
\
&& echo "Testing VCSes" \
&& which bzr \
&& which git \
&& which git-lfs \
&& which hg \
&& which svn

ENV JAVA_HOME=/opt/graalvm
ARG TARGETPLATFORM
RUN set -o errexit -o nounset \
&& echo "Installing GraalVM" \
&& JDK_BUILD=20.0.2 \
&& GRAALVM_PKG=https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-${JDK_BUILD}/graalvm-community-jdk-${JDK_BUILD}_GRAALVM_ARCH_bin.tar.gz \
&& if [ "${TARGETPLATFORM}" = "linux/amd64" ]; then GRAALVM_PKG=$(echo "${GRAALVM_PKG}" | sed "s/GRAALVM_ARCH/linux-x64/"); fi \
&& if [ "${TARGETPLATFORM}" = "linux/arm64" ]; then GRAALVM_PKG=$(echo "${GRAALVM_PKG}" | sed "s/GRAALVM_ARCH/linux-aarch64/"); fi \
&& curl --fail --silent --location --retry 3 ${GRAALVM_PKG} | gunzip | tar x -C /opt/ \
&& mv /opt/graalvm-* "${JAVA_HOME}" \
&& for bin in "$JAVA_HOME/bin/"*; do \
base="$(basename "$bin")"; \
[ ! -e "/usr/bin/$base" ]; \
update-alternatives --install "/usr/bin/${base}" "${base}" "${bin}" 1; \
done \
\
&& echo "Testing GraalVM installation" \
&& java --version \
&& javac --version \
&& gu --version \
&& native-image --version

ENV GRADLE_VERSION 8.2.1
ARG GRADLE_DOWNLOAD_SHA256=03ec176d388f2aa99defcadc3ac6adf8dd2bce5145a129659537c0874dea5ad1
RUN set -o errexit -o nounset \
&& echo "Downloading Gradle" \
&& wget --no-verbose --output-document=gradle.zip "https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip" \
\
&& echo "Checking download hash" \
&& echo "${GRADLE_DOWNLOAD_SHA256} *gradle.zip" | sha256sum --check - \
\
&& echo "Installing Gradle" \
&& unzip gradle.zip \
&& rm gradle.zip \
&& mv "gradle-${GRADLE_VERSION}" "${GRADLE_HOME}/" \
&& ln --symbolic "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle \
\
&& echo "Testing Gradle installation" \
&& gradle --version

0 comments on commit 21d137b

Please sign in to comment.