openjdk-docker icon indicating copy to clipboard operation
openjdk-docker copied to clipboard

Additional files to remove from Slim JDK/JRE builds

Open srbala opened this issue 4 years ago • 7 comments

There are few more files/folder to consider to remove from JDK/JRE Builds. This drops additional 50MB+

/opt/java/openjdk/src.zip 
/opt/java/openjdk/demo --for hotspots
/opt/java/openjdk/include 
/opt/java/openjdk/man 
/opt/java/openjdk/sample 

I am not sure /opt/java/openjdk/lib/ct.sym can be added to the list.

srbala avatar Nov 30 '20 03:11 srbala

Looking see this issue implemented. Is outside contribution allowed?

srbala avatar Apr 19 '21 04:04 srbala

@srbala Adopt is a open source project, there is no outside or inside :) You are absolutely welcome to contribute !

dinogun avatar Apr 19 '21 06:04 dinogun

@dinogun @karianna I am looking into work on fix. Here in my analysis prior to start the work.

  • Existing slim-java script contains the step to remove src.zip file, but script is not executed/called for centos, clefos, ubi, ubi-minimal etc
  • It is possible to save 12-15MB more if multi stage build step is used, where binutils package can be skipped. Please note multi-stage build gives better results compare to removing binutils. In fact some of the os ubi for example has negative impact, slight increase in size on remove packages.
  • Remove include folder and other text files like 3RDPARTY/legal can save another 1MB, can they be included in remove list?

srbala avatar Apr 29 '21 09:04 srbala

  • It is possible to save 12-15MB more if multi stage build step is used, where binutils package can be skipped. Please note multi-stage build gives better results compare to removing binutils. @dinogun @karianna, your input on multi-stage build?

srbala avatar May 01 '21 01:05 srbala

  • I think src can go as you suggest for slim
  • I'm not 100% binutils is safe to remove.
  • Legal would need to remain.

karianna avatar May 05 '21 13:05 karianna

@karianna

  • I think src can go as you suggest for slim

alpine-slim and ubuntu-slim scripts already removes src.zip, my PR will help to remove for other OSs.

  • I'm not 100% binutils is safe to remove.

Existing alpine-slim and ubuntu-slim scripts install bintools prior to run slim-java script and removes it after script complete. image

  • Legal would need to remain.

Since bintools only added for slim image and the package removed after it, it was never in the container image. bintools is not a legal issue. But, It might be for removing the 3rd-party files and text, attributes to size of 1MB.

srbala avatar May 06 '21 02:05 srbala

@dinogun I have noticed Jenkins script using docker plugin command. Is multi stage build is allowed in the verion of docker on the build server. is the docker version 19.x and above or podman 2.x and above?

Using multi stage build in Dockerfile? It can save another 13-15MB space.

srbala avatar May 26 '21 04:05 srbala