eclipse-archived / codewind

The official repository of the Eclipse Codewind project
https://codewind.dev
Eclipse Public License 2.0
114 stars 44 forks source link

standardise base docker containers and templates #1788

Closed AndyRWatson closed 4 years ago

AndyRWatson commented 4 years ago

Codewind version: 0.7 Description of the enhancement:

Codewind builds and distributes based on a number of different containers, node-10-alpine, node-12-alpine and centos. This issue is to discuss standardising where possible (or at least being consistent with node alpine versions) or whether there a other base containers we should consider using such as UBI ?

We should also consider the same for our default template apps .

Thoughts ?

Proposed solution:

tobespc commented 4 years ago

We will do the investigation into UBI

tobespc commented 4 years ago

I have the images all building with registry.access.redhat.com/ubi8/nodejs-10

james-wallis commented 4 years ago

I'm picking this work up.

/assign

james-wallis commented 4 years ago

So far I've got all PFE running locally off the registry.access.redhat.com/ubi8/nodejs-10 image with almost no other changes in the Dockerfile. One issue I'm seeing is that the image size is 764MB from the get-go with none of our packages. Our image is 1.17GB using ubi8/nodejs-10 whereas at the moment it is 919MB (Both built on my PC).

The standard registry.access.redhat.com/ubi8/ubi is 231MB for example. The minimal registry.access.redhat.com/ubi8/ubi-minimal is 106MB so obviously smaller but that is mainly due to it not having Python and using microdnf instead of yum and dnf (which requires Python).

james-wallis commented 4 years ago

Currently having an issue installing buildah, potentially related to https://github.com/containers/buildah/issues/1712

james-wallis commented 4 years ago

Am parking the use of ubi8 images in the PFE container for now and am going to explore bringing all the images to use centos instead.

Reason for parking ubi8 is that at the moment I am unable to get buildah installed inside the container. I believe this is due to the fact that I do not have a Redhat subscription and so cannot use all the repositories in the container. Having read the docs most assume you're on RHEL and have a subscription (also use buildah to build the image).

Additionally, without buildah and other packages installed in the Docker container the image size is already larger than the centos one.

james-wallis commented 4 years ago

Trying using Centos, I've made each of our images use centos:8 and as the first command install node 10 meaning that they share that layer.

Test - totally clear out my images and run ./build.sh to see the total space we'll take up when they're built. The images will be smaller on Dockerhub as they're compressed.

Before build.sh

TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
Images              0                   0                   0B                  0B
Containers          0                   0                   0B                  0B
Local Volumes       1                   0                   55.95MB             55.95MB (100%)
Build Cache         0                   0                   0B                  0B

After build.sh (Git commit used for this test https://github.com/eclipse/codewind/commit/3bff6e618b427716e69f9d705d228849678f9a17)

>> docker images
eclipse/codewind-gatekeeper-amd64    latest              ee9af3daaac7        1 second ago         382MB
eclipse/codewind-keycloak-amd64      latest              7c044c8c6d54        18 seconds ago       648MB
eclipse/codewind-performance-amd64   latest              52a1479d9671        48 seconds ago       392MB
eclipse/codewind-pfe-amd64           latest              ede93e3d28ff        2 minutes ago        879MB

^^ All 4 images add up to 2.3GB

>> docker system df  
TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
Images              8                   0                   1.795GB             1.795GB (100%)
Containers          0                   0                   0B                  0B
Local Volumes       1                   0                   55.95MB             55.95MB (100%)
Build Cache         0                   0                   0B                  0B

Our current master branch for comparison:

>> docker images
eclipse/codewind-gatekeeper-amd64    latest              67660a04b2f5        Less than a second ago   95.1MB
eclipse/codewind-keycloak-amd64      latest              b81207ce41d4        18 seconds ago           648MB
eclipse/codewind-performance-amd64   latest              53696e0af920        47 seconds ago           113MB
eclipse/codewind-pfe-amd64           latest              b2b5d5d2c618        2 minutes ago            920MB

^^ All 4 images add up to ~1.7GB

>> docker system df
TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
Images              10                  0                   1.976GB             1.976GB (100%)
Containers          0                   0                   0B                  0B
Local Volumes       1                   0                   55.95MB             55.95MB (100%)
Build Cache         0                   0                   0B                  0B

So by moving gatekeeper and keycloak to centos instead of alpine the image size for each is increased but overall the total size has decreased.

Finally, with PFE using Centos:8 but gatekeeper and keycloak using node10-alpine the image sizes are pretty much the same as the above two (PFE from the first table and everything else from the second).

>> docker system df
TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
Images              9                   0                   1.856GB             1.856GB (100%)
Containers          0                   0                   0B                  0B
Local Volumes       1                   0                   55.95MB             55.95MB (100%)
Build Cache         0                   0                   0B                  0B
tobespc commented 4 years ago

This change has given us a 600mb saving moving to centos everywhere.

AndyRWatson commented 4 years ago

600mb is a great saving. Will also simplify the porting for power

james-wallis commented 4 years ago

The PR for moving all our images to a standard image (centos:8) has been merged. In addition I've spoken to multiple people including @jopit who have been unable to get buildah running in the UBI image because it isn't included in the default yum repositories. In other IBM projects that use buildah inside a Docker image they are not using ubi but instead using Fedora.

james-wallis commented 4 years ago

Product owner from UBI discussed the differences between Centos and UBI in this post. Attaching to this closed item to keep it from being lost.

https://discuss.python.org/t/using-ubi7-images-instead-on-centos7-for-future-manylinux-images/1709/15