greyltc/docker-owncloud

Dockerfile creates unnecessary layers

djtm opened this issue · 3 comments

djtm commented

For each (RUN) command, docker creates a new intermediary filesystem layer. Each layer slows down docker a bit. (https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#minimize-the-number-of-layers) This dockerfile creates about 20 layers at least, just for owncloud itself.

https://github.com/l3iggs/docker-owncloud/blob/master/Dockerfile
Compare to the && connected commands e.g. here:
https://github.com/docker-library/owncloud/blob/ad0926eb01118dde31ca6d96bc218a73d1d6ab83/9.0/fpm/Dockerfile

Yeah, thanks for the reminder. I've got this on my list of things to cleanup.
The plan is to put the commands into one bash script and use a single RUN to call the script.
Kinda like how I've done with the parent LAMP image: https://github.com/greyltc/docker-LAMP

djtm commented

Yeah, haha, I had actually wanted to post this dockerfile: https://github.com/greyltc/docker-LAMP/blob/master/Dockerfile

Interesting trick to just put it all in a script, makes things easier to handle and nicer to read. I wish they had run blocks or something, because externalizing the script removes the caching automation again... :)

Fixed in 84f0397