noonien / docker-openwrt-buildroot

A docker container for the OpenWRT buildroot.
MIT License
117 stars 49 forks source link

Why one RUN? #11

Closed peteruithoven closed 6 years ago

peteruithoven commented 9 years ago

Currently the Dockerfile only has one RUN command. This means we don't use the build cache, which means when a step fails it has to start from scratch. Why would you do it that way? I understand from the Dockerfile best practices you shouldn't separate apt-get update and apt-get install, but why not put the rest in separate RUN's?

noonien commented 9 years ago

Because I saw no need to create several storage layers and was not interested in using the build cache. I would rather get the latest stable releases for the the needed packages.

Also, from what I can tell, the cache would not be used because there's only one Dockerfile, it does not have sibling Dockerfiles for which to cache the layers.

peteruithoven commented 9 years ago

Maybe I don't get Docker. How I understand is that I could separate:

noonien commented 9 years ago

That might be the case when working with Dockerfiles that have frequent updates, however, this is not the case.

Using build caches would also mean that if you do a new build to use the latest dependencies, those might not get updated unless you issue "--no-cache=true", this might be counter-intuitive.

peteruithoven commented 9 years ago

But, isn't that the case anyway? That it will try to get the RUN command from cache. In your case it's just one, instead of multiple?

noonien commented 6 years ago

I've split the RUN command into multiple sections, the build should work better with caches now.