Actual JDK releases based on Liberica JDK alpine musl with additional tools.
10K+
These are regularly updated images of JDK for LTS, previous and currect Java releases. Images are based on actual Bellsoft's Liberica JDK Alpine Musl.
Source code (Dockerfiles, CI pipelines) is available here.
81117212526-gradle8 means latest gradle 8.x.x version installed, 9+ otherwise.-code-coverage is deprecated and should not be used.The target audience is a groups of developers who write applications using Maven/Gradle, using Testcontainers and packing their applications into container images. It is a common practice to split into separate CI jobs building of a .jar file and packing it into docker image but when your application has tests which use Testcontainers you probably already have local docker daemon which can build your image.
We install the latest versions of Maven, Gradle and docker command line tool, so you can build your Java application, pack it into own image and push to registry within a single CI/CD job.
We forcibly update all Alpine packages to the latest versions to increase security of newer image versions and have better change to pass the pipeline's container security analyzers.
Also, there are some commonly required packages installed:
jqyqgitcurlwgettzdatagettextgcompatyamllintfontconfigttf-dejavubusybox-extrasThe effective Dockerfile for our images is:
ARG JAVA_VERSION
FROM bellsoft/liberica-openjdk-alpine-musl:${JAVA_VERSION}
# We have to keep this up to date.
ARG DOCKER_VERSION
ARG MAVEN3_VERSION
ARG GRADLE_VERSION
# Links to download binary files.
ARG DOCKER_CLI_URL="https://download.docker.com/linux/static/stable/x86_64/docker-$DOCKER_VERSION.tgz"
ARG MAVEN3_CLI_URL="https://archive.apache.org/dist/maven/maven-3/$MAVEN3_VERSION/binaries/apache-maven-$MAVEN3_VERSION-bin.zip"
ARG GRADLE_CLI_URL="https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip"
# Add installation targets to PATH.
ENV PATH="/opt/apache-maven-$MAVEN3_VERSION/bin:/opt/gradle-$GRADLE_VERSION/bin:${PATH}"
ARG ADDITIONAL_ALPINE_PACKAGES="curl"
# Ultimately update OS packages.
# hadolint ignore=DL3017, DL3018, DL3019
RUN echo "https://dl-cdn.alpinelinux.org/alpine/latest-stable/main" > /etc/apk/repositories \
&& echo "https://dl-cdn.alpinelinux.org/alpine/latest-stable/community" >> /etc/apk/repositories \
&& apk update \
&& apk upgrade --available \
&& apk add $ADDITIONAL_ALPINE_PACKAGES \
&& rm -rf /var/cache/apk/*
# ===== ===== ===== Install Docker CLI ===== ===== =====
RUN curl -s -L -o /tmp/docker-$DOCKER_VERSION.tgz $DOCKER_CLI_URL \
&& tar -x -z -C /tmp -f /tmp/docker-$DOCKER_VERSION.tgz \
&& mv /tmp/docker/docker /usr/local/bin/ \
&& rm -f /tmp/docker-$DOCKER_VERSION.tgz \
&& rm -rf /tmp/docker \
&& docker --version \
&& echo "✔️ Docker CLI ${DOCKER_VERSION} installed."
# ===== ===== ===== Install Apache Maven ===== ===== =====
RUN curl -s -L -o /opt/apache-maven-$MAVEN3_VERSION-bin.zip $MAVEN3_CLI_URL \
&& unzip -q -d /opt /opt/apache-maven-$MAVEN3_VERSION-bin.zip \
&& rm -f /opt/apache-maven-$MAVEN3_VERSION-bin.zip \
&& mvn --version \
&& echo "✔️ Maven ${MAVEN3_VERSION} installed."
# ===== ===== ===== Install Gradle ===== ===== =====
RUN curl -s -L -o /opt/gradle-$GRADLE_VERSION-bin.zip $GRADLE_CLI_URL \
&& unzip -q -d /opt /opt/gradle-$GRADLE_VERSION-bin.zip \
&& rm -f /opt/gradle-$GRADLE_VERSION-bin.zip \
&& gradle --version \
&& echo "✔️ Gradle ${GRADLE_VERSION} installed."
some-job:
image: rcktsci/java-tooling:25
services:
- docker:28-dind
variables:
MAVEN_OPTS: "-Dmaven.repo.local=${CI_PROJECT_DIR}/.m2/repository"
script:
- docker run --rm -i hadolint/hadolint < Dockerfile
- mvn --batch-mode verify
- docker build --tag my-app .
- docker push my-app
cache:
key: .m2
paths:
- .m2/repository
when: always
artifacts:
reports:
junit:
- 'target/surefire-reports/TEST-*.xml'
- 'target/failsafe-reports/TEST-*.xml'
coverage_report:
coverage_format: jacoco
path: 'target/site/jacoco/jacoco.xml'
some-job:
image: rcktsci/java-tooling:25
services:
- docker:28-dind
variables:
GRADLE_USER_HOME: "$CI_PROJECT_DIR/.gradle"
script:
- docker run --rm -i hadolint/hadolint < Dockerfile
- gradle --build-cache --info --stacktrace build
- docker build --tag my-app .
- docker push my-app
cache:
key: .gradle
paths:
- .gradle/caches/
- .gradle/wrapper/
- .gradle/build-cache/
when: always
artifacts:
reports:
junit:
- 'build/test-results/test/TEST-*.xml'
Till GitLab now supports JaCoCo code coverage report itself, we stopping to provide special -code-coverage images.
When running on shared or personal runners your have to set some environment variables up to make docker
command-line see the daemon in parallel service. In .gitlab-ci.yml:
variables:
DOCKER_HOST: tcp://docker:2376
DOCKER_TLS_CERTDIR: "/certs"
DOCKER_TLS_VERIFY: 1
DOCKER_CERT_PATH: "/certs/client"
Read its documentation carefully about that.
Content type
Image
Digest
sha256:2de888c15…
Size
291.3 MB
Last updated
2 days ago
docker pull rcktsci/java-tooling:26-docker28