After a long break I complete a series of posts on building smaller container images, this time showing how to build lightweight images for RDKit using buildah. In the previous post I introduced using buildah. In short, it showed how to package what you want into a container images without needing to include the build infrastructure (make etc.) or package managers (yum etc.).
Building RDKit containers was described in the second post of this series. The approach was essentially to build RPM or DEB packages in one heavyweight container (with cmake, g++ and everything needed to compile and build those packages) and then to yum or apt install those packages into a container that only has the runtime dependencies. However, the resulting images still contained yum or apt as well as the RPM or DEB packages, so were not as lightweight as they could be. This is where using buildah comes in.
As described in the third post of the series buildah allows to install a package into a container image without that image ending up containing the package manager. This is illustrated for building a nginx container in this repo. That example was put together for a problem solving session held by the DevOps Oxford meetup group.
The approach for building RDKit container images is a bit more complex as the code has to be compiled and packaged, but essentially RPM packages for RDKit are built in a similar way as before and they are then yum installed into the new container image. Full details can be found here. The base container image is Centos8.
These container images are significantly smaller than the ones built using the process I described previously. The Python image is 657MB compared with 741MB. The Java image is 519MB compared with 848MB. We will probably switch to using new approach with buildah at some stage. For now we build images both ways. It should also be possible to apply this approach to the debian based images.