Skip to content

Commit e9dff7a

Browse files
authored
Merge pull request #98 from scottkurz/kernel-slim
Use kernel-slim OL images for outer loop deployments
2 parents 19042f0 + 2e00867 commit e9dff7a

File tree

5 files changed

+34
-11
lines changed

5 files changed

+34
-11
lines changed

build.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ BASE_OS_IMAGE="${BASE_OS_IMAGE:-adoptopenjdk/openjdk11-openj9:ubi}"
1313
#
1414
# Version of Open Liberty runtime to use within both inner and outer loops
1515
#
16-
OL_RUNTIME_VERSION="${OL_RUNTIME_VERSION:-20.0.0.10}"
16+
OL_RUNTIME_VERSION="${OL_RUNTIME_VERSION:-20.0.0.11}"
1717

1818
#
1919
# The Open Liberty base image used in the final stage of the outer loop Dockerfile used to build your application image from
2020
#
21-
OL_UBI_IMAGE="${OL_UBI_IMAGE:-openliberty/open-liberty:20.0.0.10-kernel-java11-openj9-ubi}"
21+
OL_UBI_IMAGE="${OL_UBI_IMAGE:-openliberty/open-liberty:20.0.0.11-kernel-slim-java11-openj9-ubi}"
2222

2323
#
2424
# The name and tag of the "stack image you will build. This will used to create your inner loop development containers, and also as the base image for the first stage of your outer loop image build.
@@ -28,12 +28,12 @@ STACK_IMAGE="${STACK_IMAGE:-openliberty/application-stack:0.4}"
2828
#
2929
# URL at which your outer loop Dockerfile is hosted
3030
#
31-
DEVFILE_DOCKERFILE_LOC="${DEVFILE_DOCKERFILE_LOC:-https://github.com/OpenLiberty/application-stack/releases/download/outer-loop-0.4.0-rc/Dockerfile}"
31+
DEVFILE_DOCKERFILE_LOC="${DEVFILE_DOCKERFILE_LOC:-https://github.com/OpenLiberty/application-stack/releases/download/outer-loop-0.4.0-rc.1/Dockerfile}"
3232

3333
#
3434
# URL at which your outer loop deploy YAML template is hosted
3535
#
36-
DEVFILE_DEPLOY_YAML_LOC="${DEVFILE_DEPLOY_YAML_LOC:-https://github.com/OpenLiberty/application-stack/releases/download/outer-loop-0.4.0-rc/app-deploy.yaml}"
36+
DEVFILE_DEPLOY_YAML_LOC="${DEVFILE_DEPLOY_YAML_LOC:-https://github.com/OpenLiberty/application-stack/releases/download/outer-loop-0.4.0-rc.1/app-deploy.yaml}"
3737

3838
generate() {
3939
# Base customization.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<server>
2+
<featureManager>
3+
<feature>mpHealth-2.2</feature>
4+
</featureManager>
5+
</server>

templates/devfile.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
schemaVersion: 2.0.0
22
metadata:
33
name: java-openliberty
4-
version: 0.4.0-rc
4+
version: 0.4.0-rc.1
55
description: Java application stack using Open Liberty runtime
66
alpha.build-dockerfile: "{{.DEVFILE_DOCKERFILE_LOC}}"
77
alpha.deployment-manifest: "{{.DEVFILE_DEPLOY_YAML_LOC}}"

templates/outer-loop/Dockerfile

+17-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ RUN cd /work/outer-loop-app && \
1818
rm -f src/main/liberty/config/configDropins/defaults/quick-start-security.xml && \
1919
mvn -e liberty:create package
2020

21-
# process any resources or shared libraries - if they are present in the dependencies block for this project (there may be none potentially)
21+
# Process any resources or shared libraries - if they are present in the dependencies block for this project (there may be none potentially)
2222
# test to see if each is present and move to a well known location for later processing in the next stage
2323
#
2424
RUN cd /work/outer-loop-app/target/liberty/wlp/usr/servers && \
@@ -30,17 +30,29 @@ RUN cd /work/outer-loop-app/target/liberty/wlp/usr/servers && \
3030
# Step 2: Package Open Liberty image
3131
FROM {{.OL_UBI_IMAGE}}
3232

33-
#2a) copy any resources
33+
# 2a) Copy user defined shared resources
3434
COPY --from=compile --chown=1001:0 /work/shared /opt/ol/wlp/usr/shared/
3535

36-
# 2b) next copy shared library
36+
# 2b) Copy user defined shared libraries
3737
# but can't assume config/lib exists - copy from previous stage to a tmp holding place and test
3838
COPY --from=compile --chown=1001:0 /work/configlibdir/ /config
3939

40-
# 2c) Server config, bootstrap.properties, and everything else
40+
# 2c) Copy user defined server config, bootstrap.properties, etc.
4141
COPY --from=compile --chown=1001:0 /work/config/ /config/
4242

43-
# 2d) Changes to the application binary
43+
# 2d) Install the required features based on the defined configuration. This enables Liberty features and image size to be fit-for-purpose using featureUtility.
44+
RUN features.sh
45+
46+
# 2e) Add the microprofile health feature configuration if it is not already defined in the user's configuration.
47+
RUN mkdir -p /tmp/stack/config/configDropins/defaults
48+
COPY --from=compile --chown=1001:0 /stack/ol/config/configDropins/defaults/ /tmp/stack/config/configDropins/defaults/
49+
RUN if ! /opt/ol/wlp/bin/productInfo featureInfo | grep -q mpHealth-[0-9]*.[0-9]*; then \
50+
cp /tmp/stack/config/configDropins/defaults/liberty-stack-mpHealth.xml /config/configDropins/defaults; \
51+
features.sh; \
52+
fi
53+
RUN rm -rf /tmp/stack
54+
55+
# 2f) Copy the application binary
4456
COPY --from=compile --chown=1001:0 /work/outer-loop-app/target/*.[ew]ar /config/apps
4557
RUN configure.sh && \
4658
chmod 664 /opt/ol/wlp/usr/servers/*/configDropins/defaults/keystore.xml

templates/stackimage/Dockerfile

+7-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ RUN umask -S u=rwx,g=rwx,o=rx; mkdir -p /mvn/repository \
3030
&& chown -R java_user /mvn \
3131
&& chmod 775 /mvn \
3232
&& mkdir -p /stacks/java-openliberty/priming-app \
33+
&& mkdir -p /stacks/java-openliberty/config \
3334
&& chown -R java_user /stacks \
3435
&& mkdir -p /output \
3536
&& chown -R java_user /output \
@@ -39,6 +40,7 @@ COPY ./LICENSE /licenses/
3940

4041
USER java_user
4142

43+
ADD ./config /stacks/java-openliberty/config
4244
ADD ./priming-app/src /stacks/java-openliberty/priming-app/src
4345
COPY --chown=1001:0 ./priming-app/pom.xml /stacks/java-openliberty/priming-app/
4446

@@ -94,11 +96,15 @@ RUN mkdir -p /output \
9496
&& chmod 775 /opt/ol \
9597
&& mkdir -p /work/outer-loop-app \
9698
&& chown -R java_user /work \
97-
&& chmod -R 775 /work
99+
&& chmod -R 775 /work \
100+
&& mkdir -p /stack/ol/config/configDropins/defaults \
101+
&& chmod -R 775 /stack/ol/config/configDropins/defaults
102+
98103
# Point to local /mvn/repository within container
99104
COPY --chown=1001:0 ./mvn-stack-settings.xml /usr/share/maven/conf/settings.xml
100105
COPY --chown=1001:0 --from=builder /mvn /mvn
101106

107+
COPY --chown=1001:0 --from=builder /stacks/java-openliberty/config/configDropins/defaults/ /stack/ol/config/configDropins/defaults/
102108
COPY --chown=1001:0 --from=builder /stacks/java-openliberty/priming-app/target/liberty /opt/ol
103109
COPY --chown=1001:0 ./LICENSE /licenses/
104110

0 commit comments

Comments
 (0)