greyltc / docker-owncloud

Arch linux based docker container with owncloud
111 stars 37 forks source link

Dockerfile creates unnecessary layers #72

Closed djtm closed 8 years ago

djtm commented 8 years ago

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

greyltc commented 8 years ago

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 8 years ago

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... :)

greyltc commented 8 years ago

Fixed in 84f0397c2f9518c95b8ea3b9cbc5766c695f6392