Why are Mendix Docker images so large?

Hi all, I am just trying to understand for my own reference, why Docker images built using the “Mendix Docker Build” scripts are so large.  Even building a relatively small application, it ends up creating an image > 1GB in size without any additional build steps or amendments. Is there any way to reduce the size or best practices surrounding what to include and not include? I have tried only including what is absolutely necessary for the build to succeed, but there might be other folders items that can still be excluded? Any info would be appreciated :)
1 answers

I tried to build the image myself, ends up with 689MB as an image. I removed the entrypoint from the Dockerfile (this line), so I can run the image interactively (docker run -it <image_name> sh).

Then I poked around the filesystem. Turns out that the /opt folder is the biggest so far, here's the content:

  •  /opt/mendix/build 419M

If you take a look in that folder, you'll find that the .local folder contains the JAVA jre which is needed to run Mendix, in the runtimes folder you'll find the Mendix runtime, also needed.

Combine that with the fact that mendix/rootfs is about 200Mb, this explains the size of the image.

That being said, I'm curious how a somewhat larger project suddenly takes 400Mb more space. Could be worth looking around in the filesystem to see where everything ends up.

For reference, I followed some of the ideas to inspect and shrink Docker images from this Medium post.