LinuxForHealth / images

Linux For Health Container Images
Apache License 2.0
2 stars 2 forks source link

use java headless to cut image sizes #25

Closed herbeck558 closed 3 years ago

herbeck558 commented 3 years ago

currently using full java - using headless removes audio/video support. The --nodocs option may help as well (across the board on all microdnf commands or i think it can be set in a config file in the base image as well).

In here: https://github.com/LinuxForHealth/images/blob/master/openjdk/Dockerfile set ARG JDK_PACKAGE_NAME=java-11-openjdk-headless

(full list of java rpms is here: https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/x86_64/appstream/os/Packages/j/ ) and then add the parm --nodocs (no idea if java has docs installed but good to use this parm regardless). microdnf install -y --nodocs ${JDK_PACKAGE_NAME} &&

Finally - after running clean we usually remove the cache dir microdnf clean all && \ rm -rf /var/cache/yum

Finally, final - if you are building on a docker system w/ experimental options (or if you can enable those) - we use the docker build --squash option; at least on top level images to remove extra layers in those images.

ccorley commented 3 years ago

Thanks @herbeck558 for the PR! openjdk11-jre-headless was indeed used in creating an openjdk-alpine image used by kafdrop, kafka and zookeeper and was part of the > 50% image size reduction. The changes can be seen under PR #29.