Reduce the size of customized MDM docker image using multi-stage builds

The MDM container has Installation Manager, WAS Base, a Profile, MDM and certain utilities such as DB drivers to connect to the database in it.  

For the MDM container to function, it is sufficient if the WAS Base installation along with the profile and the database driver(s) are available in the container.  In addition, we can have the IVT folder under MDM to enable us to confirm that the product is functional.  Incase the Business Administration UI is part of the container, certain jars under a folder in MDM also need to be included.  

We can reduce the size of the runtime image that can be used in container orchestration systems like Kubernetes and OpenShift, by creating a new image having only the required files and folders.  To achieve this, we can use Docker multi-stage builds.


Below is a sample script:
FROM <CUSTOMIZED_MDM_IMAGE> AS MDM
FROM  us.icr.io/mdmaese/ubuntu-18.0.4-ossc
ENV JAVA_HOME=/opt/IBM/WebSphere/AppServer/java/8.0
ENV WAS_HOME=/opt/IBM/WebSphere/AppServer
ENV WAS_PROFILE_HOME=${WAS_HOME}/profiles/AppSrv01
ENV MDM_HOME=/opt/IBM/MDM
ENV HOME=/home/ws9admin
ENV USER_NAME=ws9admin

COPY --from=MDM /opt/IBM/WebSphere/AppServer/ /opt/IBM/WebSphere/AppServer/
COPY --from=MDM /opt/IBM/MDM/IVT/ /opt/IBM/MDM/IVT/
COPY --from=MDM /opt/IBM/MDM/jsflibs/ /opt/IBM/MDM/jsflibs/
COPY --from=MDM /tmp/ /tmp/

Comments

Popular posts from this blog

MDM v11.6 FP10: Configuring and deploying ISC on docker containers

Creating MDM image from docker container to deploy on OpenShift ?