Skip to content

Commit e246840

Browse files
authored
Merge pull request #578 from WASdev/vNext-ubi9
Add Java 21 jre ubi9 minimal image
2 parents 2a86428 + 5d885af commit e246840

4 files changed

Lines changed: 454 additions & 0 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# (C) Copyright IBM Corporation 2023.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
ARG PARENT_IMAGE=icr.io/appcafe/websphere-liberty:24.0.0.1-kernel-java21-openj9-ubi9-minimal
16+
FROM $PARENT_IMAGE AS installBundle
17+
18+
ARG VERBOSE=false
19+
ARG REPOSITORIES_PROPERTIES=""
20+
21+
# If there is a local copy of the repository use that instead
22+
COPY resources/ /tmp/
23+
24+
# Install the base bundle
25+
RUN set -eux; \
26+
if [ ! -z "$REPOSITORIES_PROPERTIES" ]; then \
27+
mkdir /opt/ibm/wlp/etc/; \
28+
echo "$REPOSITORIES_PROPERTIES" > /opt/ibm/wlp/etc/repositories.properties; \
29+
installUtility install --acceptLicense baseBundle; \
30+
rm /opt/ibm/wlp/etc/repositories.properties; \
31+
elif [ -f /tmp/wlpRepo.zip ]; then \
32+
installUtility install --acceptLicense baseBundle --from=/tmp/wlpRepo.zip; \
33+
else \
34+
installUtility install --acceptLicense baseBundle; \
35+
fi; \
36+
rm -rf /output/workarea /output/logs; \
37+
find /opt/ibm/wlp ! -perm -g=rw -print0 | xargs -r -0 chmod g+rw;
38+
39+
ARG PARENT_IMAGE=icr.io/appcafe/websphere-liberty:24.0.0.1-kernel-java21-openj9-ubi9-minimal
40+
FROM $PARENT_IMAGE
41+
ARG VERBOSE=false
42+
43+
# Copy the runtime
44+
COPY --from=installBundle --chown=1001:0 /opt/ibm/wlp /opt/ibm/wlp
45+
46+
COPY --chown=1001:0 server.xml /config/
47+
48+
# Create a new SCC layer
49+
RUN if [ "$OPENJ9_SCC" = "true" ]; then populate_scc.sh; fi \
50+
&& rm -rf /output/messaging /output/resources/security /logs/* $WLP_OUTPUT_DIR/.classCache \
51+
&& find /opt/ibm/wlp/output ! -perm -g=rwx -print0 | xargs -0 -r chmod g+rwx
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
# (C) Copyright IBM Corporation 2023.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
FROM icr.io/appcafe/ibm-semeru-runtimes:open-21-jre-ubi9-minimal AS getRuntime
16+
17+
USER root
18+
19+
ARG VERBOSE=false
20+
21+
# Install WebSphere Liberty
22+
ARG LIBERTY_VERSION=24.0.0.1
23+
ARG LIBERTY_URL
24+
ARG DOWNLOAD_OPTIONS=""
25+
26+
# If there is a local copy of the image use that instead
27+
COPY resources/ /tmp/
28+
29+
RUN microdnf -y install shadow-utils unzip wget findutils openssl \
30+
&& mkdir -p /licenses \
31+
&& useradd -u 1001 -r -g 0 -s /usr/sbin/nologin default \
32+
&& LIBERTY_URL=${LIBERTY_URL:-$(wget -q -O - https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/downloads/wlp/index.yml | grep -E "^\s*kernel:.*${LIBERTY_VERSION}\.zip" | sed -n 's/\s*kernel:\s//p' | tr -d '\r' )} \
33+
&& if [ ! -f /tmp/wlp.zip ]; then wget $DOWNLOAD_OPTIONS $LIBERTY_URL -U UA-IBM-WebSphere-Liberty-Docker -O /tmp/wlp.zip; fi \
34+
&& chmod -R g+x /usr/bin \
35+
&& unzip -q /tmp/wlp.zip -d /opt/ibm \
36+
&& chown -R 1001:0 /opt/ibm/wlp \
37+
&& chmod -R g+rw /opt/ibm/wlp \
38+
&& cp -a /opt/ibm/wlp/lafiles/. /licenses/
39+
40+
FROM icr.io/appcafe/ibm-semeru-runtimes:open-21-jre-ubi9-minimal
41+
42+
USER root
43+
44+
ARG VERBOSE=false
45+
ARG OPENJ9_SCC=true
46+
47+
ARG LIBERTY_VERSION=24.0.0.1
48+
ARG LIBERTY_BUILD_LABEL=cl240120240115-2042
49+
50+
LABEL org.opencontainers.image.authors="Leo Christy Jesuraj, Thomas Watson, Wendy Raschke, Michal Broz" \
51+
org.opencontainers.image.vendor="IBM" \
52+
org.opencontainers.image.url="https://github.com/WASdev/ci.docker" \
53+
org.opencontainers.image.documentation="https://www.ibm.com/support/knowledgecenter/SSAW57_liberty/com.ibm.websphere.wlp.nd.multiplatform.doc/ae/cwlp_about.html" \
54+
org.opencontainers.image.version="$LIBERTY_VERSION" \
55+
org.opencontainers.image.revision="$LIBERTY_BUILD_LABEL" \
56+
org.opencontainers.image.description="This image contains the WebSphere Liberty runtime with IBM Semeru Runtime Open Edition OpenJDK with OpenJ9 and Red Hat's UBI 9 minimal as the base OS. For more information on this image please see https://ibm.biz/wl-app-image-template" \
57+
org.opencontainers.image.title="IBM WebSphere Liberty" \
58+
vendor="IBM" \
59+
name="IBM WebSphere Liberty" \
60+
version="$LIBERTY_VERSION" \
61+
summary="Image for WebSphere Liberty with IBM Semeru Runtime Open Edition OpenJDK with OpenJ9 and Red Hat's UBI 9 minimal" \
62+
description="This image contains the WebSphere Liberty runtime with IBM Semeru Runtime Open Edition OpenJDK with OpenJ9 and Red Hat's UBI 9 minimal as the base OS. For more information on this image please see https://ibm.biz/wl-app-image-template"
63+
64+
ENV PATH=$PATH:/opt/ibm/wlp/bin:/opt/ibm/helpers/build
65+
66+
# Add labels for consumption by IBM Product Insights
67+
LABEL "ProductID"="fbf6a96d49214c0abc6a3bc5da6e48cd" \
68+
"ProductName"="WebSphere Application Server Liberty" \
69+
"ProductVersion"="$LIBERTY_VERSION" \
70+
"BuildLabel"="$LIBERTY_BUILD_LABEL"
71+
72+
# Install dumb-init
73+
RUN set -eux; \
74+
ARCH="$(uname -m)"; \
75+
case "${ARCH}" in \
76+
aarch64|arm64) \
77+
DUMB_INIT_URL='https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_aarch64'; \
78+
DUMB_INIT_SHA256=b7d648f97154a99c539b63c55979cd29f005f88430fb383007fe3458340b795e; \
79+
;; \
80+
amd64|x86_64) \
81+
DUMB_INIT_URL='https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_x86_64'; \
82+
DUMB_INIT_SHA256=e874b55f3279ca41415d290c512a7ba9d08f98041b28ae7c2acb19a545f1c4df; \
83+
;; \
84+
ppc64el|ppc64le) \
85+
DUMB_INIT_URL='https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_ppc64le'; \
86+
DUMB_INIT_SHA256=3d15e80e29f0f4fa1fc686b00613a2220bc37e83a35283d4b4cca1fbd0a5609f; \
87+
;; \
88+
s390x) \
89+
DUMB_INIT_URL='https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_s390x'; \
90+
DUMB_INIT_SHA256=47e4601b152fc6dcb1891e66c30ecc62a2939fd7ffd1515a7c30f281cfec53b7; \
91+
;;\
92+
*) \
93+
echo "Unsupported arch: ${ARCH}"; \
94+
exit 1; \
95+
;; \
96+
esac; \
97+
curl -LfsSo /usr/bin/dumb-init ${DUMB_INIT_URL}; \
98+
echo "${DUMB_INIT_SHA256} */usr/bin/dumb-init" | sha256sum -c -; \
99+
chmod +x /usr/bin/dumb-init;
100+
101+
# Add default user 1001 and create wlp with right user/permissions before copying
102+
RUN microdnf -y install shadow-utils findutils openssl \
103+
&& adduser -u 1001 -r -g root -s /usr/sbin/nologin default \
104+
&& mkdir -p /opt/ibm/wlp \
105+
&& chown -R 1001:0 /opt/ibm/wlp \
106+
&& chmod -R g+rw /opt/ibm/wlp \
107+
&& microdnf remove -y shadow-utils \
108+
&& microdnf clean all
109+
110+
# Copy the runtime and licenses
111+
COPY --from=getRuntime --chown=1001:0 /opt/ibm/wlp /opt/ibm/wlp
112+
COPY --from=getRuntime /licenses /licenses
113+
114+
# Set Path Shortcuts
115+
ENV LOG_DIR=/logs \
116+
WLP_OUTPUT_DIR=/opt/ibm/wlp/output \
117+
OPENJ9_SCC=$OPENJ9_SCC
118+
119+
# Configure WebSphere Liberty
120+
RUN /opt/ibm/wlp/bin/server create \
121+
&& rm -rf $WLP_OUTPUT_DIR/.classCache /output/workarea \
122+
&& rm -rf /opt/ibm/wlp/usr/servers/defaultServer/server.env
123+
124+
COPY NOTICES /opt/ibm/NOTICES
125+
COPY helpers/ /opt/ibm/helpers/
126+
COPY fixes/ /opt/ibm/fixes/
127+
128+
# Create symlinks && set permissions for non-root user
129+
RUN mkdir /logs \
130+
&& mkdir /etc/wlp \
131+
&& mkdir -p /opt/ibm/wlp/usr/shared/resources/lib.index.cache \
132+
&& mkdir -p /home/default \
133+
&& mkdir /output \
134+
&& chmod -t /output \
135+
&& rm -rf /output \
136+
&& ln -s $WLP_OUTPUT_DIR/defaultServer /output \
137+
&& ln -s /opt/ibm/wlp/usr/servers/defaultServer /config \
138+
&& ln -s /opt/ibm/wlp /liberty \
139+
&& ln -s /opt/ibm/fixes /fixes \
140+
&& ln -s /opt/ibm/wlp/usr/shared/resources/lib.index.cache /lib.index.cache \
141+
&& mkdir -p /config/configDropins/defaults \
142+
&& mkdir -p /config/configDropins/overrides \
143+
&& chown -R 1001:0 /config \
144+
&& chmod -R g+rw /config \
145+
&& chown -R 1001:0 /opt/ibm/helpers \
146+
&& chmod -R g+rwx /opt/ibm/helpers \
147+
&& chown -R 1001:0 /opt/ibm/fixes \
148+
&& chmod -R g+rwx /opt/ibm/fixes \
149+
&& chown -R 1001:0 /opt/ibm/wlp/usr \
150+
&& chmod -R g+rw /opt/ibm/wlp/usr \
151+
&& chown -R 1001:0 /opt/ibm/wlp/output \
152+
&& chmod -R g+rw /opt/ibm/wlp/output \
153+
&& chown -R 1001:0 /logs \
154+
&& chmod -R g+rw /logs \
155+
&& chown -R 1001:0 /etc/wlp \
156+
&& chmod -R g+rw /etc/wlp \
157+
&& if [ -e /etc/instanton.ld.so.cache ]; then chmod g+w /etc/ld.so.cache; fi \
158+
&& chown -R 1001:0 /home/default \
159+
&& chmod -R g+rw /home/default
160+
161+
# Create a new SCC layer
162+
RUN if [ "$OPENJ9_SCC" = "true" ]; then populate_scc.sh; fi \
163+
&& rm -rf /output/messaging /output/resources/security /logs/* $WLP_OUTPUT_DIR/.classCache \
164+
&& chown -R 1001:0 /opt/ibm/wlp/output \
165+
&& chmod -R g+rwx /opt/ibm/wlp/output
166+
167+
# These settings are needed so that we can run as a different user than 1001 after server warmup
168+
ENV RANDFILE=/tmp/.rnd \
169+
OPENJ9_JAVA_OPTIONS="-XX:+IgnoreUnrecognizedVMOptions -XX:+IdleTuningGcOnIdle -Xshareclasses:name=openj9_system_scc,cacheDir=/opt/java/.scc,readonly,nonFatal -Dosgi.checkConfiguration=false"
170+
171+
USER 1001
172+
173+
EXPOSE 9080 9443
174+
175+
ENTRYPOINT ["/opt/ibm/helpers/runtime/docker-server.sh"]
176+
CMD ["/opt/ibm/wlp/bin/server", "run", "defaultServer"]
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# (C) Copyright IBM Corporation 2023.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
ARG PARENT_IMAGE=icr.io/appcafe/websphere-liberty:kernel-java21-openj9-ubi9-minimal
16+
FROM $PARENT_IMAGE AS installBundle
17+
18+
ARG VERBOSE=false
19+
ARG REPOSITORIES_PROPERTIES=""
20+
21+
# If there is a local copy of the repository use that instead
22+
COPY resources/ /tmp/
23+
24+
# Install the base bundle
25+
RUN set -eux; \
26+
if [ ! -z "$REPOSITORIES_PROPERTIES" ]; then \
27+
mkdir /opt/ibm/wlp/etc/; \
28+
echo "$REPOSITORIES_PROPERTIES" > /opt/ibm/wlp/etc/repositories.properties; \
29+
installUtility install --acceptLicense baseBundle; \
30+
rm /opt/ibm/wlp/etc/repositories.properties; \
31+
elif [ -f /tmp/wlpRepo.zip ]; then \
32+
installUtility install --acceptLicense baseBundle --from=/tmp/wlpRepo.zip; \
33+
else \
34+
installUtility install --acceptLicense baseBundle; \
35+
fi; \
36+
rm -rf /output/workarea /output/logs; \
37+
find /opt/ibm/wlp ! -perm -g=rw -print0 | xargs -r -0 chmod g+rw;
38+
39+
ARG PARENT_IMAGE=icr.io/appcafe/websphere-liberty:kernel-java21-openj9-ubi9-minimal
40+
FROM $PARENT_IMAGE
41+
ARG VERBOSE=false
42+
43+
# Copy the runtime
44+
COPY --from=installBundle --chown=1001:0 /opt/ibm/wlp /opt/ibm/wlp
45+
46+
COPY --chown=1001:0 server.xml /config/
47+
48+
# Create a new SCC layer
49+
RUN if [ "$OPENJ9_SCC" = "true" ]; then populate_scc.sh; fi \
50+
&& rm -rf /output/messaging /output/resources/security /logs/* $WLP_OUTPUT_DIR/.classCache \
51+
&& find /opt/ibm/wlp/output ! -perm -g=rwx -print0 | xargs -0 -r chmod g+rwx

0 commit comments

Comments
 (0)