Skip to content

Commit b8d9ad2

Browse files
kabicinkabicin
authored andcommitted
Update 22.0.0.8
1 parent e5de794 commit b8d9ad2

12 files changed

Lines changed: 488 additions & 92 deletions
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
#!/bin/bash
2+
# (C) Copyright IBM Corporation 2022.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# Determine if featureUtility ran in an earlier build step
17+
if [ -f "/opt/ibm/wlp/configure-liberty.log" ]; then
18+
FEATURES_INSTALLED=true
19+
else
20+
FEATURES_INSTALLED=false
21+
>&2 echo "WARNING: This is not an optimal build configuration. Although features in server.xml will continue to be installed correctly, the 'RUN features.sh' command should be added to the Dockerfile prior to configure.sh. See https://github.com/WASdev/ci.docker#building-an-application-image for a sample application image template."
22+
fi
23+
24+
if [ "$VERBOSE" != "true" ]; then
25+
exec &>/dev/null
26+
fi
27+
28+
set -Eeox pipefail
29+
30+
function main() {
31+
if [ "$FEATURES_INSTALLED" == "false" ]; then
32+
# Resolve liberty server symlinks and creation for server name changes
33+
/opt/ibm/helpers/runtime/configure-liberty.sh
34+
if [ $? -ne 0 ]; then
35+
exit
36+
fi
37+
fi
38+
39+
##Define variables for XML snippets source and target paths
40+
WLP_INSTALL_DIR=/opt/ibm/wlp
41+
SHARED_CONFIG_DIR=${WLP_INSTALL_DIR}/usr/shared/config
42+
SHARED_RESOURCE_DIR=${WLP_INSTALL_DIR}/usr/shared/resources
43+
44+
SNIPPETS_SOURCE=/opt/ibm/helpers/build/configuration_snippets
45+
SNIPPETS_TARGET=/config/configDropins/overrides
46+
SNIPPETS_TARGET_DEFAULTS=/config/configDropins/defaults
47+
mkdir -p ${SNIPPETS_TARGET}
48+
mkdir -p ${SNIPPETS_TARGET_DEFAULTS}
49+
50+
#Check for each Liberty value-add functionality
51+
52+
# Infinispan Session Caching
53+
if [[ -n "$INFINISPAN_SERVICE_NAME" ]]; then
54+
cp ${SNIPPETS_SOURCE}/infinispan-client-sessioncache.xml ${SNIPPETS_TARGET}/infinispan-client-sessioncache.xml
55+
chmod g+rw $SNIPPETS_TARGET/infinispan-client-sessioncache.xml
56+
fi
57+
58+
# Hazelcast Session Caching
59+
if [ "${HZ_SESSION_CACHE}" == "client" ] || [ "${HZ_SESSION_CACHE}" == "embedded" ]; then
60+
cp ${SNIPPETS_SOURCE}/hazelcast-sessioncache.xml ${SNIPPETS_TARGET}/hazelcast-sessioncache.xml
61+
mkdir -p ${SHARED_CONFIG_DIR}/hazelcast
62+
cp ${SNIPPETS_SOURCE}/hazelcast-${HZ_SESSION_CACHE}.xml ${SHARED_CONFIG_DIR}/hazelcast/hazelcast.xml
63+
fi
64+
65+
# Key Store
66+
keystorePath="$SNIPPETS_TARGET_DEFAULTS/keystore.xml"
67+
if [ "$SSL" != "false" ] && [ "$TLS" != "false" ]
68+
then
69+
if [ ! -e $keystorePath ]
70+
then
71+
# Generate the keystore.xml
72+
export KEYSTOREPWD=$(openssl rand -base64 32)
73+
sed "s|REPLACE|$KEYSTOREPWD|g" $SNIPPETS_SOURCE/keystore.xml > $SNIPPETS_TARGET_DEFAULTS/keystore.xml
74+
chmod g+w $SNIPPETS_TARGET_DEFAULTS/keystore.xml
75+
fi
76+
fi
77+
78+
# SSO
79+
if [[ -n "$SEC_SSO_PROVIDERS" ]]; then
80+
parseProviders $SEC_SSO_PROVIDERS
81+
fi
82+
83+
if [ "$SKIP_FEATURE_INSTALL" != "true" ]; then
84+
# Install needed features
85+
if [ "$FEATURE_REPO_URL" ]; then
86+
curl -k --fail $FEATURE_REPO_URL > /tmp/repo.zip
87+
installUtility install --acceptLicense defaultServer --from=/tmp/repo.zip || rc=$?; if [ $rc -ne 22 ]; then exit $rc; fi
88+
rm -rf /tmp/repo.zip
89+
# Otherwise, if features.sh did not run, install server features.
90+
elif [ "$FEATURES_INSTALLED" == "false" ]; then
91+
featureUtility installServerFeatures --acceptLicense defaultServer --noCache
92+
find /opt/ibm/wlp/lib /opt/ibm/wlp/bin ! -perm -g=rw -print0 | xargs -0 -r chmod g+rw
93+
fi
94+
fi
95+
96+
# Apply interim fixes found in /opt/ibm/fixes
97+
# Fixes recommended by IBM, such as to resolve security vulnerabilities, are also included in /opt/ibm/fixes
98+
# Note: This step should be done once needed features are enabled and installed using installUtility.
99+
100+
# Do not create a SCC
101+
if [ -n "${IBM_JAVA_OPTIONS}" ]; then
102+
IBM_JAVA_OPTIONS="${IBM_JAVA_OPTIONS} -Xshareclasses:none"
103+
fi
104+
105+
if [ -n "${OPENJ9_JAVA_OPTIONS}" ]; then
106+
OPENJ9_JAVA_OPTIONS="${OPENJ9_JAVA_OPTIONS} -Xshareclasses:none"
107+
fi
108+
109+
find /opt/ibm/fixes -type f -name "*.jar" -print0 | sort -z | xargs -0 -n 1 -r -I {} java -jar {} --installLocation $WLP_INSTALL_DIR
110+
#Make sure that group write permissions are set correctly after installing new features
111+
find /opt/ibm/wlp ! -perm -g=rw -print0 | xargs -r -0 chmod g+rw
112+
113+
# Create a new SCC layer
114+
if [ "$OPENJ9_SCC" == "true" ]
115+
then
116+
populate_scc.sh -i 1
117+
fi
118+
}
119+
120+
## parse provider list to generate files into configDropins
121+
function parseProviders() {
122+
while [ $# -gt 0 ]; do
123+
case "$1" in
124+
oidc:*)
125+
parseCommaList oidc "${1#*:}"
126+
;;
127+
oauth2:*)
128+
parseCommaList oauth2 "${1#*:}"
129+
;;
130+
*)
131+
if [[ $(ls $SNIPPETS_SOURCE | grep "$1") ]]; then
132+
cp $SNIPPETS_SOURCE/sso-${1}.xml $SNIPPETS_TARGET_DEFAULTS
133+
fi
134+
;;
135+
esac
136+
shift
137+
done
138+
}
139+
140+
## process the comma delimitted oauth2/oidc source lists
141+
function parseCommaList() {
142+
local type="$1"
143+
local list=$(echo "$2" | tr , " ")
144+
145+
for current in ${list}; do
146+
if [[ "${type}" = "oidc" ]]; then
147+
# replace oidc identifiers with custom name
148+
sed -e 's/=\"oidc/=\"'${current}'/g' -e 's/_OIDC_/_'${current^^}'_/g' $SNIPPETS_SOURCE/sso-oidc.xml > $SNIPPETS_TARGET_DEFAULTS/sso-${current}.xml
149+
else
150+
# replace oauth2 identifiers with custom name
151+
sed -e 's/=\"oauth2/=\"'${current}'/g' -e 's/_OAUTH2_/_'${current^^}'_/g' $SNIPPETS_SOURCE/sso-oauth2.xml > $SNIPPETS_TARGET_DEFAULTS/sso-${current}.xml
152+
fi
153+
done
154+
}
155+
156+
main "$@"
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
# (C) Copyright IBM Corporation 2022.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
if [ "$VERBOSE" != "true" ]; then
16+
exec &>/dev/null
17+
fi
18+
19+
set -Eeox pipefail
20+
21+
# Resolve liberty server symlinks and creation for server name changes
22+
/opt/ibm/helpers/runtime/configure-liberty.sh
23+
if [ $? -ne 0 ]; then
24+
exit
25+
fi
26+
27+
##Define variables for XML snippets source and target paths
28+
SNIPPETS_SOURCE=/opt/ibm/helpers/build/configuration_snippets
29+
SNIPPETS_TARGET=/config/configDropins/overrides
30+
SNIPPETS_TARGET_DEFAULTS=/config/configDropins/defaults
31+
mkdir -p ${SNIPPETS_TARGET}
32+
mkdir -p ${SNIPPETS_TARGET_DEFAULTS}
33+
34+
# Session Caching
35+
if [ -n "$INFINISPAN_SERVICE_NAME" ] || [ "${HZ_SESSION_CACHE}" == "client" ] || [ "${HZ_SESSION_CACHE}" == "embedded" ]; then
36+
cp ${SNIPPETS_SOURCE}/sessioncache-features.xml ${SNIPPETS_TARGET}/sessioncache-features.xml
37+
chmod g+rw $SNIPPETS_TARGET/sessioncache-features.xml
38+
fi
39+
40+
# SSO
41+
if [[ -n "$SEC_SSO_PROVIDERS" ]]; then
42+
cp $SNIPPETS_SOURCE/sso-features.xml $SNIPPETS_TARGET_DEFAULTS
43+
fi
44+
45+
# Key Store
46+
if [ "$SSL" == "true" ] || [ "$TLS" == "true" ]; then
47+
cp $SNIPPETS_SOURCE/tls.xml $SNIPPETS_TARGET/tls.xml
48+
fi
49+
50+
# Install necessary features using featureUtility
51+
featureUtility installServerFeatures --acceptLicense defaultServer --noCache
52+
find /opt/ibm/wlp/lib /opt/ibm/wlp/bin ! -perm -g=rw -print0 | xargs -0 -r chmod g+rw

ga/23.0.0.6/kernel/Dockerfile.ubi.ibmjava8

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -130,32 +130,50 @@ RUN mkdir /logs \
130130
&& mkdir /etc/wlp \
131131
&& mkdir -p /opt/ibm/wlp/usr/shared/resources/lib.index.cache \
132132
&& 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 \
138133
&& ln -s /opt/ibm /liberty \
139134
&& ln -s /opt/ibm/fixes /fixes \
140135
&& 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 \
145136
&& chown -R 1001:0 /opt/ibm/helpers \
146137
&& chmod -R g+rwx /opt/ibm/helpers \
147138
&& chown -R 1001:0 /opt/ibm/fixes \
148139
&& chmod -R g+rwx /opt/ibm/fixes \
149140
&& chown -R 1001:0 /opt/ibm/wlp/usr \
150141
&& 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 \
153142
&& chown -R 1001:0 /logs \
154143
&& chmod -R g+rw /logs \
155144
&& chown -R 1001:0 /etc/wlp \
156145
&& chmod -R g+rw /etc/wlp \
157146
&& chown -R 1001:0 /home/default \
158-
&& chmod -R g+rw /home/default
147+
&& chmod -R g+rw /home/default \
148+
&& mkdir -p /opt/ibm/links \
149+
&& chown -R 1001:0 /opt/ibm/links \
150+
&& chmod -R g+rw /opt/ibm/links
151+
152+
# Create second-level symlinks as non-root user
153+
USER 1001
154+
155+
RUN mkdir -p $WLP_OUTPUT_DIR/defaultServer \
156+
&& ln -s $WLP_OUTPUT_DIR/defaultServer /opt/ibm/links/output \
157+
&& ln -s /opt/ibm/wlp/usr/servers/defaultServer /opt/ibm/links/config \
158+
&& mkdir -p /opt/ibm/links/config/configDropins/defaults \
159+
&& mkdir -p /opt/ibm/links/config/configDropins/overrides
160+
161+
# Create first-level symlinks as root user
162+
USER 0
163+
164+
RUN mkdir /output \
165+
&& chmod -t /output \
166+
&& rm -rf /output \
167+
&& ln -s /opt/ibm/links/output /output \
168+
&& ln -s /opt/ibm/links/config /config \
169+
&& chown -R 1001:0 /opt/ibm/links/output \
170+
&& chmod -R g+rw /opt/ibm/links/output \
171+
&& chown -R 1001:0 /opt/ibm/links/config \
172+
&& chmod -R g+rw /opt/ibm/links/config \
173+
&& chown -R 1001:0 /config \
174+
&& chmod -R g+rw /config \
175+
&& chown -R 1001:0 /output \
176+
&& chmod -R g+rw /output
159177

160178
# Create a new SCC layer
161179
RUN if [ "$OPENJ9_SCC" = "true" ]; then populate_scc.sh; fi \
@@ -172,4 +190,4 @@ USER 1001
172190
EXPOSE 9080 9443
173191

174192
ENTRYPOINT ["/opt/ibm/helpers/runtime/docker-server.sh"]
175-
CMD ["/opt/ibm/wlp/bin/server", "run", "defaultServer"]
193+
CMD ["/opt/ibm/wlp/bin/server", "run"]

ga/23.0.0.6/kernel/Dockerfile.ubi.openjdk11

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -130,32 +130,50 @@ RUN mkdir /logs \
130130
&& mkdir /etc/wlp \
131131
&& mkdir -p /opt/ibm/wlp/usr/shared/resources/lib.index.cache \
132132
&& 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 \
138133
&& ln -s /opt/ibm /liberty \
139134
&& ln -s /opt/ibm/fixes /fixes \
140135
&& 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 \
145136
&& chown -R 1001:0 /opt/ibm/helpers \
146137
&& chmod -R g+rwx /opt/ibm/helpers \
147138
&& chown -R 1001:0 /opt/ibm/fixes \
148139
&& chmod -R g+rwx /opt/ibm/fixes \
149140
&& chown -R 1001:0 /opt/ibm/wlp/usr \
150141
&& 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 \
153142
&& chown -R 1001:0 /logs \
154143
&& chmod -R g+rw /logs \
155144
&& chown -R 1001:0 /etc/wlp \
156145
&& chmod -R g+rw /etc/wlp \
157146
&& chown -R 1001:0 /home/default \
158-
&& chmod -R g+rw /home/default
147+
&& chmod -R g+rw /home/default \
148+
&& mkdir -p /opt/ibm/links \
149+
&& chown -R 1001:0 /opt/ibm/links \
150+
&& chmod -R g+rw /opt/ibm/links
151+
152+
# Create second-level symlinks as non-root user
153+
USER 1001
154+
155+
RUN mkdir -p $WLP_OUTPUT_DIR/defaultServer \
156+
&& ln -s $WLP_OUTPUT_DIR/defaultServer /opt/ibm/links/output \
157+
&& ln -s /opt/ibm/wlp/usr/servers/defaultServer /opt/ibm/links/config \
158+
&& mkdir -p /opt/ibm/links/config/configDropins/defaults \
159+
&& mkdir -p /opt/ibm/links/config/configDropins/overrides
160+
161+
# Create first-level symlinks as root user
162+
USER 0
163+
164+
RUN mkdir /output \
165+
&& chmod -t /output \
166+
&& rm -rf /output \
167+
&& ln -s /opt/ibm/links/output /output \
168+
&& ln -s /opt/ibm/links/config /config \
169+
&& chown -R 1001:0 /opt/ibm/links/output \
170+
&& chmod -R g+rw /opt/ibm/links/output \
171+
&& chown -R 1001:0 /opt/ibm/links/config \
172+
&& chmod -R g+rw /opt/ibm/links/config \
173+
&& chown -R 1001:0 /config \
174+
&& chmod -R g+rw /config \
175+
&& chown -R 1001:0 /output \
176+
&& chmod -R g+rw /output
159177

160178
# Create a new SCC layer
161179
RUN if [ "$OPENJ9_SCC" = "true" ]; then populate_scc.sh; fi \
@@ -172,4 +190,4 @@ USER 1001
172190
EXPOSE 9080 9443
173191

174192
ENTRYPOINT ["/opt/ibm/helpers/runtime/docker-server.sh"]
175-
CMD ["/opt/ibm/wlp/bin/server", "run", "defaultServer"]
193+
CMD ["/opt/ibm/wlp/bin/server", "run"]

0 commit comments

Comments
 (0)