Skip to content

Commit

Permalink
Sync files /jdk17 runtime-image
Browse files Browse the repository at this point in the history
  • Loading branch information
rdnovell committed Jan 21, 2025
1 parent c918c47 commit 2337ee6
Show file tree
Hide file tree
Showing 49 changed files with 1,964 additions and 0 deletions.
210 changes: 210 additions & 0 deletions container-images/jdk17/runtime-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@

# This is a Dockerfile for the jboss-eap-8-tech-preview/eap81-openjdk17-runtime-openshift-rhel9:1.0.0.Beta image.


## START target image jboss-eap-8-tech-preview/eap81-openjdk17-runtime-openshift-rhel9:1.0.0.Beta
## \
FROM registry.access.redhat.com/ubi9/ubi-minimal


USER root

###### START module 'jboss.container.user:2.0+jboss1'
###### \
# Copy 'jboss.container.user' module content
COPY modules/jboss.container.user /tmp/scripts/jboss.container.user
# Switch to 'root' user for package management for 'jboss.container.user' module defined packages
USER root
# Install packages defined in the 'jboss.container.user' module
RUN microdnf --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install -y shadow-utils \
&& microdnf clean all \
&& rpm -q shadow-utils
# Set 'jboss.container.user' module defined environment variables
ENV \
GECOS="JBoss user" \
HOME="/home/jboss" \
UID="185" \
USER="jboss"
# Custom scripts from 'jboss.container.user' module
USER root
RUN [ "sh", "-x", "/tmp/scripts/jboss.container.user/configure.sh" ]
###### /
###### END module 'jboss.container.user:2.0+jboss1'

###### START module 'jboss.container.openjdk:0'
###### \
###### /
###### END module 'jboss.container.openjdk:0'

###### START module 'jboss.container.openjdk.jdk:17'
###### \
# Copy 'jboss.container.openjdk.jdk' module content
COPY modules/jboss.container.openjdk.jdk /tmp/scripts/jboss.container.openjdk.jdk
# Switch to 'root' user for package management for 'jboss.container.openjdk.jdk' module defined packages
USER root
# Install packages defined in the 'jboss.container.openjdk.jdk' module
RUN microdnf --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install -y java-17-openjdk-devel \
&& microdnf clean all \
&& rpm -q java-17-openjdk-devel
# Set 'jboss.container.openjdk.jdk' module defined environment variables
ENV \
JAVA_HOME="/usr/lib/jvm/java-17" \
JAVA_VENDOR="openjdk" \
JAVA_VERSION="17" \
JBOSS_CONTAINER_OPENJDK_JDK_MODULE="/opt/jboss/container/openjdk/jdk"
# Set 'jboss.container.openjdk.jdk' module defined labels
LABEL \
org.jboss.product="openjdk" \
org.jboss.product.openjdk.version="17" \
org.jboss.product.version="17"
# Custom scripts from 'jboss.container.openjdk.jdk' module
USER root
RUN [ "sh", "-x", "/tmp/scripts/jboss.container.openjdk.jdk/configure.sh" ]
###### /
###### END module 'jboss.container.openjdk.jdk:17'

###### START module 'jboss.container.wildfly.dynamic-resources:2.0'
###### \
# Copy 'jboss.container.wildfly.dynamic-resources' module content
COPY modules/jboss.container.wildfly.dynamic-resources /tmp/scripts/jboss.container.wildfly.dynamic-resources
# Custom scripts from 'jboss.container.wildfly.dynamic-resources' module
USER root
RUN [ "sh", "-x", "/tmp/scripts/jboss.container.wildfly.dynamic-resources/install.sh" ]
###### /
###### END module 'jboss.container.wildfly.dynamic-resources:2.0'

###### START module 'jboss.container.java.proxy:2.0'
###### \
# Copy 'jboss.container.java.proxy' module content
COPY modules/jboss.container.java.proxy /tmp/scripts/jboss.container.java.proxy
# Set 'jboss.container.java.proxy' module defined environment variables
ENV \
JBOSS_CONTAINER_JAVA_PROXY_MODULE="/opt/jboss/container/java/proxy"
# Custom scripts from 'jboss.container.java.proxy' module
USER root
RUN [ "sh", "-x", "/tmp/scripts/jboss.container.java.proxy/configure.sh" ]
###### /
###### END module 'jboss.container.java.proxy:2.0'

###### START module 'jboss.container.java.jvm:1.0'
###### \
# Copy 'jboss.container.java.jvm' module content
COPY modules/jboss.container.java.jvm /tmp/scripts/jboss.container.java.jvm
# Set 'jboss.container.java.jvm' module defined environment variables
ENV \
JBOSS_CONTAINER_JAVA_JVM_MODULE="/opt/jboss/container/java/jvm"
# Custom scripts from 'jboss.container.java.jvm' module
USER root
RUN [ "sh", "-x", "/tmp/scripts/jboss.container.java.jvm/configure.sh" ]
###### /
###### END module 'jboss.container.java.jvm:1.0'

###### START module 'jboss.container.wildfly.run.api:1.0'
###### \
###### /
###### END module 'jboss.container.wildfly.run.api:1.0'

###### START module 'jboss.container.wildfly.run.common:1.0'
###### \
# Copy 'jboss.container.wildfly.run.common' module content
COPY modules/jboss.container.wildfly.run.common /tmp/scripts/jboss.container.wildfly.run.common
# Set 'jboss.container.wildfly.run.common' module defined environment variables
ENV \
JBOSS_CONTAINER_WILDFLY_RUN_MODULE="/opt/jboss/container/wildfly/run" \
WILDFLY_OVERRIDING_ENV_VARS="1"
# Custom scripts from 'jboss.container.wildfly.run.common' module
USER root
RUN [ "sh", "-x", "/tmp/scripts/jboss.container.wildfly.run.common/configure.sh" ]
###### /
###### END module 'jboss.container.wildfly.run.common:1.0'

###### START module 'jboss.container.util.logging:1.0'
###### \
# Copy 'jboss.container.util.logging' module content
COPY modules/jboss.container.util.logging /tmp/scripts/jboss.container.util.logging
# Set 'jboss.container.util.logging' module defined environment variables
ENV \
JBOSS_CONTAINER_UTIL_LOGGING_MODULE="/opt/jboss/container/util/logging/"
# Custom scripts from 'jboss.container.util.logging' module
USER root
RUN [ "sh", "-x", "/tmp/scripts/jboss.container.util.logging/configure.sh" ]
###### /
###### END module 'jboss.container.util.logging:1.0'

###### START module 'jboss.container.wildfly.run:2.0'
###### \
###### /
###### END module 'jboss.container.wildfly.run:2.0'

###### START module 'jboss.container.eap.cleanup:1.0'
###### \
# Copy 'jboss.container.eap.cleanup' module content
COPY modules/jboss.container.eap.cleanup /tmp/scripts/jboss.container.eap.cleanup
# Set 'jboss.container.eap.cleanup' module defined environment variables
ENV \
JBOSS_HOME="/opt/server"
# Custom scripts from 'jboss.container.eap.cleanup' module
USER 185
RUN [ "sh", "-x", "/tmp/scripts/jboss.container.eap.cleanup/configure.sh" ]
###### /
###### END module 'jboss.container.eap.cleanup:1.0'

###### START module 'jboss.container.util.pkg-update:1.0'
###### \
# Copy 'jboss.container.util.pkg-update' module content
COPY modules/jboss.container.util.pkg-update /tmp/scripts/jboss.container.util.pkg-update
# Custom scripts from 'jboss.container.util.pkg-update' module
USER root
RUN [ "sh", "-x", "/tmp/scripts/jboss.container.util.pkg-update/execute.sh" ]
###### /
###### END module 'jboss.container.util.pkg-update:1.0'

###### START image 'jboss-eap-8-tech-preview/eap81-openjdk17-runtime-openshift-rhel9:1.0.0.Beta'
###### \
# Switch to 'root' user for package management for 'jboss-eap-8-tech-preview/eap81-openjdk17-runtime-openshift-rhel9' image defined packages
USER root
# Install packages defined in the 'jboss-eap-8-tech-preview/eap81-openjdk17-runtime-openshift-rhel9' image
RUN microdnf --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install -y hostname jq vim-minimal unzip tar \
&& microdnf clean all \
&& rpm -q hostname jq vim-minimal unzip tar
# Set 'jboss-eap-8-tech-preview/eap81-openjdk17-runtime-openshift-rhel9' image defined environment variables
ENV \
IMAGE_NAME="jboss-eap-8-tech-preview/eap81-openjdk17-runtime-openshift-rhel9" \
IMAGE_VERSION="1.0.0.Beta" \
SSO_DEFAULT_PROVIDER_NAME="rh-sso"
# Set 'jboss-eap-8-tech-preview/eap81-openjdk17-runtime-openshift-rhel9' image defined labels
LABEL \
com.redhat.component="jboss-eap81-openjdk17-runtime-openshift-container" \
com.redhat.deployments-dir="/opt/server/standalone/deployments" \
description="The JBoss EAP 8.1 OpenJDK 17 runtime image" \
io.cekit.version="4.14.0" \
io.k8s.description="Base image to run an EAP 8.1 server and application" \
io.k8s.display-name="JBoss EAP 8.1 runtime image" \
io.openshift.expose-services="8080:http" \
io.openshift.tags="javaee,eap,eap8" \
maintainer="Red Hat" \
name="jboss-eap-8-tech-preview/eap81-openjdk17-runtime-openshift-rhel9" \
org.jboss.product="eap81-openjdk17-runtime" \
org.jboss.product.version="1.0.0.Beta" \
summary="The JBoss EAP 8.1 OpenJDK 17 runtime image"
# Exposed ports in 'jboss-eap-8-tech-preview/eap81-openjdk17-runtime-openshift-rhel9' image
EXPOSE 8443 8080
###### /
###### END image 'jboss-eap-8-tech-preview/eap81-openjdk17-runtime-openshift-rhel9:1.0.0.Beta'



# Switch to 'root' user and remove artifacts and modules
USER root
RUN rm -rf "/tmp/scripts" "/tmp/artifacts"
# Clear package manager metadata
RUN rm -rf "/var/cache/yum" "/var/lib/dnf" "/var/cache/apt" "/var/cache/dnf"

# Define the user
USER 185
# Define the working directory
WORKDIR /home/jboss
# Define run cmd
CMD ["sh", "-c", "${JBOSS_CONTAINER_WILDFLY_RUN_MODULE}/run"]
## /
## END target image
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh
# Configure module
set -e

ln -s "$JBOSS_HOME" /opt/eap

# Handle UBI9 specifics, otherwise cloud feature-pack for 8.0 would break
# Only create the link for UBI9 image.
if [ -n "${JBOSS_CONTAINER_JAVA_PROXY_MODULE}" ]; then
if [ ! -f /opt/run-java/proxy-options ]; then
mkdir -p /opt/run-java/
ln -s "${JBOSS_CONTAINER_JAVA_PROXY_MODULE}/proxy-options" /opt/run-java/proxy-options
fi
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
args: []
artifacts: []
description: Finalize installation. Create symlink from JBOSS_HOME to /opt/eap
envs:
- name: JBOSS_HOME
value: /opt/server
execute:
- directory: jboss.container.eap.cleanup
module_name: jboss.container.eap.cleanup
name: jboss.container.eap.cleanup/configure.sh
script: configure.sh
user: 185
labels: []
modules:
install: []
repositories: []
name: jboss.container.eap.cleanup
osbs:
configuration: {}
repository: {}
packages:
repositories: []
ports: []
schema_version: 1
version: '1.0'
volumes: []
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

# Check for debug options and echo them if enabled. Meant to be included by
# a run script.

debug_options() {
if [ "x${JAVA_DEBUG}" != "x" ]; then
local debug_port=${JAVA_DEBUG_PORT:-5005}
echo "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=${debug_port}"
fi
}

## Echo options, trimming trailing and multiple spaces
echo "$(debug_options)" | awk '$1=$1'
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#!/bin/sh
# =================================================================
# Detect whether running in a container and set appropriate options
# for limiting Java VM resources
#
# Usage: JAVA_OPTS="$(java-default-options.sh)"

# stubs for jvm specific overrides
jvm_specific_options() {
:
}

jvm_specific_diagnostics() {
:
}

# Include overridden jvm_specific_*() functions
if [ -f "${JBOSS_CONTAINER_OPENJDK_JDK_MODULE}/jvm-options" ]; then
source "${JBOSS_CONTAINER_OPENJDK_JDK_MODULE}/jvm-options"
fi

# Check for memory options and calculate a sane default if not given
max_memory() {
case "$JAVA_MAX_MEM_RATIO" in
"0") # explicitly disabled
return
;;
"")
maxmem="80.0"
;;
*)
maxmem="$(printf "%.0f.0" "$JAVA_MAX_MEM_RATIO")"
;;
esac
echo "-XX:MaxRAMPercentage=$maxmem"
}

# Switch on diagnostics except when switched off
diagnostics() {
if [ "x$JAVA_DIAGNOSTICS" != "x" ]; then
echo "$(jvm_specific_diagnostics)"
fi
}

gc_config() {
local minHeapFreeRatio=${GC_MIN_HEAP_FREE_RATIO:-10}
local maxHeapFreeRatio=${GC_MAX_HEAP_FREE_RATIO:-20}
local timeRatio=${GC_TIME_RATIO:-4}
local adaptiveSizePolicyWeight=${GC_ADAPTIVE_SIZE_POLICY_WEIGHT:-90}
local gcOptions="${GC_CONTAINER_OPTIONS:--XX:+UseParallelGC}"

# for compat reasons we don't set a default value for metaspaceSize
local metaspaceSize
# We also don't set a default value for maxMetaspaceSize
local maxMetaspaceSize=${GC_MAX_METASPACE_SIZE}

if [ -n "${GC_METASPACE_SIZE}" ]; then
metaspaceSize=${GC_METASPACE_SIZE}
if [ -n "${maxMetaspaceSize}" ]; then
# clamp the max size of metaspaceSize to be <= maxMetaspaceSize
if [ "${metaspaceSize}" -gt "${maxMetaspaceSize}" ]; then
metaspaceSize=${maxMetaspaceSize}
fi
fi
fi

local allOptions="$(jvm_specific_options) "
allOptions+="${gcOptions} "
allOptions+="-XX:MinHeapFreeRatio=${minHeapFreeRatio} "
allOptions+="-XX:MaxHeapFreeRatio=${maxHeapFreeRatio} "
allOptions+="-XX:GCTimeRatio=${timeRatio} "
allOptions+="-XX:AdaptiveSizePolicyWeight=${adaptiveSizePolicyWeight} "
# if no value was specified for maxMetaSpaceSize we should skip passing it entirely
if [ -n "${maxMetaspaceSize}" ]; then
allOptions+="-XX:MaxMetaspaceSize=${maxMetaspaceSize}m "
fi
if [ -n "${metaspaceSize}" ]; then
allOptions+="-XX:MetaspaceSize=${metaspaceSize}m "
fi

echo "${allOptions}"
}

error_handling() {
echo "-XX:+ExitOnOutOfMemoryError"
}

## Echo options, trimming trailing and multiple spaces
echo "$(max_memory) $(gc_config) $(diagnostics) $(error_handling)" | awk '$1=$1'
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh
# Configure module
set -e

SCRIPT_DIR=$(dirname $0)
ARTIFACTS_DIR=${SCRIPT_DIR}/artifacts

chown -R $USER:root $SCRIPT_DIR
chmod -R ug+rwX $SCRIPT_DIR
chmod ug+x ${ARTIFACTS_DIR}/opt/jboss/container/java/jvm/*

pushd ${ARTIFACTS_DIR}
cp -pr * /
popd
Loading

0 comments on commit 2337ee6

Please sign in to comment.