|
@@ -0,0 +1,90 @@
|
|
|
+## Overview
|
|
|
+
|
|
|
+The images in this repository contain OpenJDK binaries that are built by Eclipse Temurin.
|
|
|
+
|
|
|
+# What is Eclipse Temurin ?
|
|
|
+
|
|
|
+The Eclipse Temurin project provides code and processes that support the building of runtime binaries and associated technologies that are high performance, enterprise-caliber, cross-platform, open-source licensed, and Java SE TCK-tested for general use across the Java ecosystem.
|
|
|
+
|
|
|
+# Images
|
|
|
+
|
|
|
+Current there are only JDK (Java Developer Kit) images. On OpenJDK 11+ JRE's can be produced using `jlink` (see usage below).
|
|
|
+
|
|
|
+### Multi-Arch Image
|
|
|
+
|
|
|
+Docker Images for the following architectures are now available:
|
|
|
+
|
|
|
+- `amd64`, `windows-amd64`, `arm64v8`, `ppc64le`
|
|
|
+
|
|
|
+More architecures will be available shortly.
|
|
|
+
|
|
|
+# How to use this Image
|
|
|
+
|
|
|
+To run a pre-built jar file with the latest OpenJDK 11, use the following Dockerfile:
|
|
|
+
|
|
|
+```dockerfile
|
|
|
+FROM %%IMAGE%%:11
|
|
|
+RUN mkdir /opt/app
|
|
|
+COPY japp.jar /opt/app
|
|
|
+CMD ["java", "-jar", "/opt/app/japp.jar"]
|
|
|
+```
|
|
|
+
|
|
|
+You can build and run the Docker Image as shown in the following example:
|
|
|
+
|
|
|
+```console
|
|
|
+docker build -t japp .
|
|
|
+docker run -it --rm japp
|
|
|
+```
|
|
|
+
|
|
|
+### Using a different base Image
|
|
|
+
|
|
|
+If you are using a distribution that we don't provide an image for you can copy the JDK using a similar Dockerfile to the one below:
|
|
|
+
|
|
|
+```dockerfile
|
|
|
+# Example
|
|
|
+FROM <base image>
|
|
|
+ENV JAVA_HOME=/opt/java/openjdk
|
|
|
+COPY --from=%%IMAGE%%:11 $JAVA_HOME $JAVA_HOME
|
|
|
+ENV PATH="${JAVA_HOME}/bin:${PATH}"
|
|
|
+```
|
|
|
+
|
|
|
+### Creating a JRE using jlink
|
|
|
+
|
|
|
+On OpenJDK 11+, a JRE can be generated using `jlink`, see the following Dockerfile:
|
|
|
+
|
|
|
+```dockerfile
|
|
|
+# Example of custom Java runtime using jlink in a multi-stage container build
|
|
|
+FROM %%IMAGE%%:11 as jre-build
|
|
|
+
|
|
|
+# Create a custom Java runtime
|
|
|
+RUN $JAVA_HOME/bin/jlink \
|
|
|
+ --add-modules java.base \
|
|
|
+ --strip-debug \
|
|
|
+ --no-man-pages \
|
|
|
+ --no-header-files \
|
|
|
+ --compress=2 \
|
|
|
+ --output /javaruntime
|
|
|
+
|
|
|
+# Define your base image
|
|
|
+FROM debian:buster-slim
|
|
|
+ENV JAVA_HOME=/opt/java/openjdk
|
|
|
+ENV PATH "${JAVA_HOME}/bin:${PATH}"
|
|
|
+COPY --from=jre-build /javaruntime $JAVA_HOME
|
|
|
+
|
|
|
+# Continue with your application deployment
|
|
|
+RUN mkdir /opt/app
|
|
|
+COPY japp.jar /opt/app
|
|
|
+CMD ["java", "-jar", "/opt/app/japp.jar"]
|
|
|
+```
|
|
|
+
|
|
|
+If you want to place the jar file on the host file system instead of inside the container, you can mount the host path onto the container by using the following commands:
|
|
|
+
|
|
|
+```dockerfile
|
|
|
+FROM %%IMAGE%%:11.0.12_7-jdk
|
|
|
+CMD ["java", "-jar", "/opt/app/japp.jar"]
|
|
|
+```
|
|
|
+
|
|
|
+```console
|
|
|
+docker build -t japp .
|
|
|
+docker run -it -v /path/on/host/system/jars:/opt/app japp
|
|
|
+```
|