ot4i / ace-docker

73 stars 167 forks source link

ACE container image is TOO LARGE! #203

Open abudavis opened 6 months ago

abudavis commented 6 months ago

Platform: CP4I 2022.2.1 on Openshift 4.12 ACE: 12.0.11.2 LTS

@trevor-dolby-at-ibm-com

We are a customer based out of Europe and have been using ACE on Cloud Pak since 2019 on Openshift where we run 100's of ACE pods. Our main concern is the size of the ACE docker image. The image actually becomes much larger in our production as we use a docker file to install drivers, scripts and other stuff, and there seems to be a limit on the number of docker instructions (we hit upon an error), we think the docker layers have a limit in combination with the image size. I know there exists a feature of switching off stuff you dont need but that doesn't seem to make dramatic change to the image size.

Since IBM acquired web methods, I'd like to say for comparison, webmethods has a docker image size of 350MB. I would like to know if there is some way of reducing the already large ACE image smaller (may be 100's of MB instead of 1GB+) while still being supported by IBM or if this may be in the future roadmap?

Please find a sample docker instructions we use in our build config attached, any suggestions to improve these docker instructions would also be great!

https://hub.docker.com/layers/softwareag/webmethods-microservicesruntime/10.15.0.1/images/sha256-a0eba62e2f580591aa18d6202f58087b2c6a01c25609846b285e2fb5dfd99828

apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
  name: $IMAGESTREAM
  namespace: ace
  labels:
    app: $IMAGESTREAM
spec:
  source:
    type: Dockerfile
    git:
      uri: https://github.com/company/acestuff.git
      ref: master
    contextDir: pipeline
    sourceSecret:
      name: gitsecret
    dockerfile: |-
      FROM
      ENV TZ='Europe/Oslo'
      ENV MQSI_VAULT_KEY='redacted'
      RUN mkdir -p /home/aceuser/fileinput /home/aceuser/fileoutput
      RUN chmod 777 /home/aceuser/fileinput /home/aceuser/fileoutput
      ADD scripts/stopstartflow.sh /home/aceuser
      ADD scripts/overrideudp.sh /home/aceuser
      ADD scripts/trace.sh /home/aceuser
      USER root
      RUN ln -s /home/aceuser/generic/vault /home/aceuser/ace-server/config/vault
      RUN chmod 755 /home/aceuser/stopstartflow.sh /home/aceuser/overrideudp.sh /home/aceuser/trace.sh
      RUN mkdir -p /opt/ibm/ace-12/server/JDBC /tmp/db2install /tmp/progressopenedgedbdriver /tmp/databricksdbdriver /home/aceuser/jars
      ADD jars/* /home/aceuser/jars
      ADD drivers/msql/*.jar /opt/ibm/ace-12/server/JDBC/
      ADD drivers/db2/jdbc/*.jar /opt/ibm/ace-12/server/JDBC/
      ADD drivers/db2/odbc/*.tgz /tmp/db2install
      RUN cp /tmp/db2install/IBMiAccess_v1r1_LinuxAP/odbc/libodbcinst.so.2.0.0 /lib64/
      RUN ln -s /lib64/libodbcinst.so.2.0.0 /lib64/libodbcinst.so.2
      RUN rpm -i /tmp/db2install/IBMiAccess_v1r1_LinuxAP/x86_64/ibm-iaccess-1.1.0.13-1.0.x86_64.rpm --nodeps
      RUN ldd /opt/ibm/iaccess/lib64/libcwbodbc.so
      RUN ln -s /opt/ibm/iaccess/lib64/libcwbodbc.so /opt/ibm/ace-12/server/ODBC/drivers/lib/libcwbodbc.so
      ADD drivers/openedge/odbc/*.* /tmp/progressopenedgedbdriver
      RUN /tmp/progressopenedgedbdriver/proinst -b /tmp/progressopenedgedbdriver/response.ini -l /tmp/progressopenedgedbdriverinstall.log
      RUN cp /usr/dlc/odbc/lib/libpgicu27.so /usr/lib64
      RUN ldd /usr/dlc/odbc/lib/pgoe27.so
      RUN ln -s /usr/dlc/odbc/lib/pgoe27.so /opt/ibm/ace-12/server/ODBC/drivers/lib/pgoe27.so
      RUN cat /tmp/progressopenedgedbdriverinstall.log
      ADD drivers/databricks/odbc/*.tgz /tmp/databricksdbdriver
      RUN rpm -i /tmp/databricksdbdriver/*.rpm
      RUN ldd /opt/simba/spark/lib/64/libsparkodbc_sb64.so
      EXPOSE 7600 7800 7843 9483
  strategy:
    type: Docker
    dockerStrategy:
      from:
        kind: DockerImage
        name: $LATEST_AVAILABLE_IMAGE
      pullSecret:
        name: ibm-entitlement-key
  output:
    to:
      kind: ImageStreamTag
      name: $IMAGESTREAM:latest
  runPolicy: Serial
  successfulBuildsHistoryLimit: 5
  failedBuildsHistoryLimit: 5
  postCommit: {}
IBMRob commented 6 months ago

Hi,

In terms of the issue around layers, I would recommend putting multiple of your commands onto a single RUN command - this will enable you to perform a number of your commands in a single layer. This is a great blog all around developing effecting images - https://emmer.dev/blog/reducing-docker-layers.

The size of the image is something we are looking at in the future. As you will see in this repo we have got some experimental work around reducing the image sizes in https://github.com/ot4i/ace-docker/tree/main/experimental/ace-minimal. Is there a size of image that you think is the max target. For this issue I would recommend raising an Idea l in https://integration-development.ideas.ibm.com/ideas/?project=APPC.

Note this repo is not designed for support tickets for CP4I or ACE, it's purely for the samples provided in this repo.

abudavis commented 6 months ago

Hi,

In terms of the issue around layers, I would recommend putting multiple of your commands onto a single RUN command - this will enable you to perform a number of your commands in a single layer. This is a great blog all around developing effecting images - https://emmer.dev/blog/reducing-docker-layers.

The size of the image is something we are looking at in the future. As you will see in this repo we have got some experimental work around reducing the image sizes in https://github.com/ot4i/ace-docker/tree/main/experimental/ace-minimal. Is there a size of image that you think is the max target. For this issue I would recommend raising an Idea l in https://integration-development.ideas.ibm.com/ideas/?project=APPC.

Note this repo is not designed for support tickets for CP4I or ACE, it's purely for the samples provided in this repo.

Thank you for the quick reply and suggestions. The image size is starting to become a big problem especially since the ACE + ACE Manufacturing pack (now supports container deployments) image is large with our EDGE sites having very limited local storage/ephemeral storage. I would think the image size would be within 500MB at the most which isn't the case with ACE at the moment.