OpenLiberty / ci.docker

Eclipse Public License 1.0
43 stars 59 forks source link

Document the approach to copy ear/war contents instead of using autoExpand #467

Open leochr opened 11 months ago

leochr commented 11 months ago

Document that customers should copy the expanded ear/war at image build time instead of using autoExpand

When <applicationManager autoExpand="true" /> is set in Liberty server configuration and RUN configure.sh is called, the application will be expanded as part of the server start and stop process to generate shared class cache (SCC) to speed up startup time. This will result in the application image containing the app content twice - one as war, the other as expanded directory. This won't be a concern for applications are small in size. But it can significantly increase the image size when the application size is big.

Sample:

FROM icr.io/appcafe/open-liberty:kernel-slim-java11-openj9-ubi
COPY --chown=1001:0 src/main/liberty/config /config
RUN features.sh
COPY --chown=1001:0 target/app-name/ /config/apps/app-name.war/
RUN configure.sh
gcharters commented 11 months ago

We need to document how to do this for .ear files too. I have these steps for @NottyCode but I haven't tried them.

.... if it is an ear they should extract it to a directory with the same name, any war files in extracted ear should also be extracted into a directory with the same name as the war.