Dockerfile improvements#636
Dockerfile improvements#636discordianfish merged 2 commits intoprometheus:masterfrom sdurrheimer:master
Conversation
Signed-off-by: Steve Durrheimer <[email protected]>
… buildpack-deps:jessie-scm, gcc => golang:1.4) Signed-off-by: Steve Durrheimer <[email protected]>
|
👍 from my limited knowledge about Docker best practices. @discordianfish, opinion about the base image change? |
|
@sdurrheimer Thanks! Looks good. On the long term, we want to build really small images based on the binary builds of prometheus. Unfortunatly that isn't ready yet. @grobie IIRC you wanted to work on this. Do you have an ETA? |
Dockerfile improvements
|
Hi again, I did some tests building a small size docker image. Take a look : |
|
@sdurrheimer Love it! Can you submit a PR? This might breaks people who assumes that this image is ubuntu and try to install ubuntu base but I still think it's worth it. |
|
There are definitly breaking changes. It will affect people :
Some precisions :
|
|
Well I would be okay breaking people with that change. The thing is, it's a inherit design issue with Docker, there is just no way to provide a stable interface to people who build upon a image. Nothing we can do about that. |
fileutil.Replace - remove destination only when a directory.

Hi,
Here are some improvements on weight and build's speed of the docker image.
apt-get cleanis useless because debian base image is already configured to remove the package cache after eachapt-get install. (/etc/apt/apt.conf.d/docker-clean).However, image can be lightened with
rm -rf /var/lib/apt/lists/*. Anyway, this change fixes the following error when extending prom/promtheus image :Here a picture to illustrate this change :

Finally gcc and mercurial package are already installed by inherited images.
In my opinion, there are more ways to optimise this image. Presently it's pretty heavy. A lot of this heavyness is coming from the golang base image. Maybe can we find a way to build this from a base image like gliderlabs/alpine in the way others golang programs does like gliderlabs/registrator or gliderlabs/logspout.
Although maybe can we, in the first place, find a way to replace xxd usage in order to remove the vim-common package, adding 59MB to the image.
Hope this helps.
@beorn7 @juliusv @discordianfish