-
Notifications
You must be signed in to change notification settings - Fork 123
/
Copy pathDockerfile.ubi9-minimal.ibmjava8
198 lines (171 loc) · 8.44 KB
/
Dockerfile.ubi9-minimal.ibmjava8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# (C) Copyright IBM Corporation 2025.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This relies on a base image which needs to be built seperately
# curl https://raw.githubusercontent.com/ibmruntimes/ci.docker/main/ibmjava/8/jre/ubi-min/Dockerfile -o java/Dockerfile.ubi9.minimal
# The above file needs editing before it is built:
# This changes to a UBI9 base, and corrects the microdnf command to work on UBI9.
# $> sed -i -e 's/ubi8/ubi9/' -e 's/microdnf install/microdnf -y install/' -e 's/microdnf update/microdnf update -y/' Dockerfile.ubi9-minimal.ibmjava8
# $> rm ./java/Dockerfile.ubi9.minimal.bak
# Then build and tag as 'ibmjava:9-ubi'
# $> docker build -t ibmjava:9-ubi -f ./java/Dockerfile.ubi9.minimal java
FROM ibmjava:9-ubi AS getRuntime
USER root
ARG VERBOSE=false
# Install WebSphere Liberty
ARG LIBERTY_VERSION=25.0.0.4
ARG LIBERTY_URL
ARG DOWNLOAD_OPTIONS=""
ARG LIBERTY_SHA=9f30a336264ad7fe10fff6e0dfabc71ef8483760
# If there is a local copy of the image use that instead
COPY resources/ /tmp/
RUN microdnf -y install shadow-utils unzip wget findutils openssl \
&& mkdir -p /licenses \
# This is removed compared to the UBI8 dockerfile as the base
# java dockerfile already adds this user
# && useradd -u 1001 -r -g 0 -s /usr/sbin/nologin default \
&& 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' )} \
&& if [ ! -f /tmp/wlp.zip ]; then wget $DOWNLOAD_OPTIONS $LIBERTY_URL -U UA-IBM-WebSphere-Liberty-Docker -O /tmp/wlp.zip; fi \
&& echo "$LIBERTY_SHA /tmp/wlp.zip" > /tmp/wlp.zip.sha1 \
&& sha1sum -c /tmp/wlp.zip.sha1 \
&& chmod -R g+x /usr/bin \
&& unzip -q /tmp/wlp.zip -d /opt/ibm \
&& chown -R 1001:0 /opt/ibm/wlp \
&& chmod -R g+rw /opt/ibm/wlp \
&& cp -a /opt/ibm/wlp/lafiles/. /licenses/
FROM ibmjava:9-ubi
USER root
ARG VERBOSE=false
ARG OPENJ9_SCC=true
ARG LIBERTY_VERSION=25.0.0.4
ARG LIBERTY_BUILD_LABEL=cl250420250407-1902
LABEL org.opencontainers.image.authors="Leo Christy Jesuraj, Iain Lewis, Melissa Lee, Kirby Chin" \
org.opencontainers.image.vendor="IBM" \
org.opencontainers.image.url="https://github.com/WASdev/ci.docker" \
org.opencontainers.image.documentation="https://www.ibm.com/support/knowledgecenter/SSAW57_liberty/com.ibm.websphere.wlp.nd.multiplatform.doc/ae/cwlp_about.html" \
org.opencontainers.image.version="$LIBERTY_VERSION" \
org.opencontainers.image.revision="$LIBERTY_BUILD_LABEL" \
org.opencontainers.image.description="This image contains the WebSphere Liberty runtime with IBM's Java 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" \
org.opencontainers.image.title="IBM WebSphere Liberty" \
liberty.version="$LIBERTY_VERSION" \
com.ibm.websphere.liberty.version="$LIBERTY_VERSION" \
vendor="IBM" \
name="IBM WebSphere Liberty" \
version="$LIBERTY_VERSION" \
summary="Image for WebSphere Liberty with IBM's Java and Red Hat's UBI 9 minimal" \
description="This image contains the WebSphere Liberty runtime with IBM's Java 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"
ENV PATH=$PATH:/opt/ibm/wlp/bin:/opt/ibm/helpers/build
# Add labels for consumption by IBM Product Insights
LABEL "ProductID"="fbf6a96d49214c0abc6a3bc5da6e48cd" \
"ProductName"="WebSphere Application Server Liberty" \
"ProductVersion"="$LIBERTY_VERSION" \
"BuildLabel"="$LIBERTY_BUILD_LABEL"
# Install dumb-init
RUN set -eux; \
ARCH="$(uname -m)"; \
case "${ARCH}" in \
aarch64|arm64) \
DUMB_INIT_URL='https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_aarch64'; \
DUMB_INIT_SHA256=b7d648f97154a99c539b63c55979cd29f005f88430fb383007fe3458340b795e; \
;; \
amd64|x86_64) \
DUMB_INIT_URL='https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_x86_64'; \
DUMB_INIT_SHA256=e874b55f3279ca41415d290c512a7ba9d08f98041b28ae7c2acb19a545f1c4df; \
;; \
ppc64el|ppc64le) \
DUMB_INIT_URL='https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_ppc64le'; \
DUMB_INIT_SHA256=3d15e80e29f0f4fa1fc686b00613a2220bc37e83a35283d4b4cca1fbd0a5609f; \
;; \
s390x) \
DUMB_INIT_URL='https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_s390x'; \
DUMB_INIT_SHA256=47e4601b152fc6dcb1891e66c30ecc62a2939fd7ffd1515a7c30f281cfec53b7; \
;;\
*) \
echo "Unsupported arch: ${ARCH}"; \
exit 1; \
;; \
esac; \
curl -LfsSo /usr/bin/dumb-init ${DUMB_INIT_URL}; \
echo "${DUMB_INIT_SHA256} */usr/bin/dumb-init" | sha256sum -c -; \
chmod +x /usr/bin/dumb-init;
# Add default user 1001 and create wlp with right user/permissions before copying
RUN microdnf -y install shadow-utils findutils openssl \
# This is removed compared to the UBI8 dockerfile as the base
# java dockerfile already adds this user
# && adduser -u 1001 -r -g root -s /usr/sbin/nologin default \
&& mkdir -p /opt/ibm/wlp \
&& chown -R 1001:0 /opt/ibm/wlp \
&& chmod -R g+rw /opt/ibm/wlp \
&& microdnf remove -y shadow-utils \
&& microdnf clean all
# Copy the runtime and licenses
COPY --from=getRuntime --chown=1001:0 /opt/ibm/wlp /opt/ibm/wlp
COPY --from=getRuntime /licenses /licenses
# Set Path Shortcuts
ENV LOG_DIR=/liberty/logs \
WLP_OUTPUT_DIR=/opt/ibm/wlp/output \
OPENJ9_SCC=$OPENJ9_SCC
# Configure WebSphere Liberty
RUN /opt/ibm/wlp/bin/server create \
&& rm -rf $WLP_OUTPUT_DIR/.classCache /output/workarea \
&& rm -rf /opt/ibm/wlp/usr/servers/defaultServer/server.env
COPY NOTICES /opt/ibm/NOTICES
COPY helpers/ /opt/ibm/helpers/
COPY fixes/ /opt/ibm/fixes/
# Create symlinks && set permissions for non-root user
RUN mkdir /logs \
&& chown -R 1001:0 /logs \
&& chmod -R g+rw /logs \
&& mkdir /etc/wlp \
&& mkdir -p /opt/ibm/wlp/usr/shared/resources/lib.index.cache \
&& mkdir -p /home/default \
&& mkdir /output \
&& chmod -t /output \
&& rm -rf /output \
&& ln -s $WLP_OUTPUT_DIR/defaultServer /output \
&& ln -s /opt/ibm/wlp/usr/servers/defaultServer /config \
&& ln -s /opt/ibm/wlp /liberty \
&& ln -s /opt/ibm/fixes /fixes \
&& ln -s /opt/ibm/wlp/usr/shared/resources/lib.index.cache /lib.index.cache \
&& mkdir -p /config/configDropins/defaults \
&& mkdir -p /config/configDropins/overrides \
&& chown -R 1001:0 /config \
&& chmod -R g+rw /config \
&& chown -R 1001:0 /opt/ibm/helpers \
&& chmod -R ug+rwx /opt/ibm/helpers \
&& chown -R 1001:0 /opt/ibm/fixes \
&& chmod -R g+rwx /opt/ibm/fixes \
&& chown -R 1001:0 /opt/ibm/wlp/usr \
&& chmod -R g+rw /opt/ibm/wlp/usr \
&& chown -R 1001:0 /opt/ibm/wlp/output \
&& chmod -R g+rw /opt/ibm/wlp/output \
&& chown -R 1001:0 /etc/wlp \
&& chmod -R g+rw /etc/wlp \
&& chown -R 1001:0 /home/default \
&& chmod -R g+rw /home/default \
&& ln -s /logs /liberty/logs \
&& mkdir /serviceability \
&& chown -R 1001:0 /serviceability \
&& chmod -R g+rw /serviceability
# Create a new SCC layer
RUN if [ "$OPENJ9_SCC" = "true" ]; then populate_scc.sh; fi \
&& rm -rf /output/messaging /output/resources/security /logs/* $WLP_OUTPUT_DIR/.classCache \
&& chown -R 1001:0 /opt/ibm/wlp/output \
&& chmod -R g+rwx /opt/ibm/wlp/output
# These settings are needed so that we can run as a different user than 1001 after server warmup
ENV RANDFILE=/tmp/.rnd \
IBM_JAVA_OPTIONS="-Xshareclasses:name=liberty,readonly,nonfatal,cacheDir=/output/.classCache/ -Dosgi.checkConfiguration=false ${IBM_JAVA_OPTIONS}"
USER 1001
EXPOSE 9080 9443
ENTRYPOINT ["/opt/ibm/helpers/runtime/docker-server.sh"]
CMD ["/opt/ibm/wlp/bin/server", "run", "defaultServer"]