Matthias Andreas Benkard | a907495 | 2022-05-13 20:47:42 +0200 | [diff] [blame] | 1 | // SPDX-FileCopyrightText: © 2022 Matthias Andreas Benkard <code@mail.matthias.benkard.de> |
| 2 | // |
| 3 | // SPDX-License-Identifier: GFDL-1.3-or-later |
| 4 | |
| 5 | = openjdk-runtime |
| 6 | Matthias Andreas Benkard |
| 7 | // Meta |
| 8 | :experimental: |
| 9 | :data-uri: |
| 10 | :sectnums: |
| 11 | :toc: |
| 12 | :stem: |
| 13 | :keywords: mulk |
| 14 | // Settings |
| 15 | :icons: font |
| 16 | :source-highlighter: rouge |
| 17 | |
| 18 | A container image that contains an OpenJDK runtime suitable for running |
| 19 | modern web services. |
| 20 | |
| 21 | |
| 22 | == Summary |
| 23 | |
| 24 | This container image ships the latest OpenJDK feature release from |
| 25 | https://jdk.java.net[jdk.java.net] on top of a |
| 26 | https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/building_running_and_managing_containers/assembly_types-of-container-images_building-running-and-managing-containers#con_understanding-the-ubi-micro-images_assembly_types-of-container-images[Red |
| 27 | Hat UBI Micro] base. |
| 28 | |
Matthias Andreas Benkard | 776cee3 | 2022-05-13 22:27:08 +0200 | [diff] [blame] | 29 | By default the image contains all modules shipped with OpenJDK. |
Matthias Andreas Benkard | a907495 | 2022-05-13 20:47:42 +0200 | [diff] [blame] | 30 | |
| 31 | |
| 32 | == Building |
| 33 | |
| 34 | [source,shell] |
| 35 | ---- |
| 36 | ./prepare |
| 37 | docker build -t $IMAGE_NAME . |
| 38 | ---- |
| 39 | |
| 40 | |
| 41 | == Customization |
| 42 | |
| 43 | You may want to customize the module set included in the JDK. |
| 44 | |
Matthias Andreas Benkard | 776cee3 | 2022-05-13 22:27:08 +0200 | [diff] [blame] | 45 | For example, say all you need are `java.base` and `java.naming`, then |
| 46 | the following excludes everything else contained in the OpenJDK |
| 47 | distribution: |
Matthias Andreas Benkard | a907495 | 2022-05-13 20:47:42 +0200 | [diff] [blame] | 48 | |
| 49 | [source,dockerfile] |
| 50 | ---- |
| 51 | RUN /jdk/*/bin/jlink \ |
| 52 | -J-XX:MaxRAMPercentage=75 \ |
Matthias Andreas Benkard | 776cee3 | 2022-05-13 22:27:08 +0200 | [diff] [blame] | 53 | --add-modules java.base,java.naming \ #<1> |
Matthias Andreas Benkard | a907495 | 2022-05-13 20:47:42 +0200 | [diff] [blame] | 54 | --compress=1 \ |
| 55 | --no-man-pages \ |
| 56 | --strip-debug \ |
| 57 | --output /java |
| 58 | ---- |
Matthias Andreas Benkard | 776cee3 | 2022-05-13 22:27:08 +0200 | [diff] [blame] | 59 | <1> Include the JDK modules that you need. |
Matthias Andreas Benkard | a907495 | 2022-05-13 20:47:42 +0200 | [diff] [blame] | 60 | |
| 61 | |
| 62 | == Usage |
| 63 | |
| 64 | [source,shell] |
| 65 | ---- |
| 66 | docker run $IMAGE_NAME java -version |
| 67 | ---- |
Matthias Andreas Benkard | 44a658a | 2022-05-19 06:46:52 +0200 | [diff] [blame] | 68 | |
| 69 | |
| 70 | == License |
| 71 | |
| 72 | This recipe is freely redistributable under the GNU General Public |
| 73 | License, version 3, or, at your option, any later version. |
| 74 | |
| 75 | Redistribution of the resulting container image is subject to the |
| 76 | https://www.redhat.com/en/about/agreements#UBI[Red Hat Universal Base |
| 77 | Image EULA] in addition to the license terms applicable to the |
| 78 | individual software components it consists of. |