AdoptOpenJDK / openjdk-docker

Scripts for creating Docker images of OpenJDK binaries.
https://hub.docker.com/_/adoptopenjdk/
Apache License 2.0
425 stars 237 forks source link

Additional files to remove from Slim JDK/JRE builds #478

Open srbala opened 3 years ago

srbala commented 3 years ago

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 commented 3 years ago

Looking see this issue implemented. Is outside contribution allowed?

dinogun commented 3 years ago

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

srbala commented 3 years ago

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

srbala commented 3 years ago
  • 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?
karianna commented 3 years ago
srbala commented 3 years ago

@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 commented 3 years ago

@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.