sagemath / docker-images

Dockerfiles for Sage
54 stars 18 forks source link

Optimize the size of the images #3

Open nthiery opened 8 years ago

nthiery commented 8 years ago

In theory we should be able to make them smaller than that the current virtual machines (2Gb, which is already huge).

sebasguts commented 8 years ago

You are right. I will have a look at Unikernel, which might help us to strip down the OS.

@vbraun How do you create the VM image, do you have some script we could look at? I am not sure what blows up the image that much. From my point of view we are doing everything right. But maybe Sage can somehow strip down its installation by removing unneeded files?

Also, VirtualBox seems to be able to compress its images. In fact, Docker compresses for upload and download, too, but the images seem to be stored uncompressed, I think maybe for speed.

vbraun commented 8 years ago

The VM build script is here: https://bitbucket.org/vbraun/sage-virtual-appliance-buildscript

Further possibilities:

embray commented 8 years ago

@vbraun I'll see about applying that script to the docker images and see if that helps reduce their size.

embray commented 8 years ago

@vbraun It seems to me that running sage -t -a breaks if the sources are deleted. I think it's good for users to be run at least a portion of the test suite to test their installation, regardless of how it was installed or if the full sources are still available. This is something I'd like to pursue fixing.

You also wrote "strip binaries"--what do you mean in this case?

embray commented 8 years ago

The .git directory only adds about 21 MB right now, so I might not bother deleting it. Though if you're sure it's not at all useful to have then we could do that--shaving off every little bit helps.

Also, when building the images we apt-get install wget build-essential automake m4 dpkg-dev sudo python libssl-dev git, which adds about 187 MB, but it's not clear that all of those are required at runtime. Obviously some are, like Python. But we could probably uninstall some packages that are no longer needed after build.

vbraun commented 8 years ago
embray commented 8 years ago

Ah okay, that's what I thought you meant just wanted to be sure. For the -develop images we'll want to leave symbols intact for debugging, but for the release images we can do that.

I agree the deletion of unused build artifacts should be improved upstream. In fact I would like to the entire src/ dir be treated as an artifact and improve the test runner so that the tests can be run without src/ (tests in all .py modules should be possible be run out of ./local/lib/python2.7/site-packages/sage; it's been suggested to me that this won't work for tests in Cython modules but I have ideas about that--still need to investigate further).