sstarcher / docker-sensu

Dockerized Sensu - Client, Server, Api
MIT License
103 stars 72 forks source link

Shrinking image size #37

Closed sstarcher closed 7 years ago

sstarcher commented 7 years ago

Moved build deps into the /bin/install script New image size is 188mb

@masneyb @ajmath @rhussmann @kelcecil @MichaelRBond @jdavis92 @alexjpaz @brendangibat @jmmartin

I think that's all of the people who commented on #34. Could someone test this PR before I merge it.

kelcecil commented 7 years ago

I'll test it tomorrow if someone doesn't beat me to it. On Sun, Jan 22, 2017 at 2:16 PM Shane Starcher notifications@github.com wrote:

Moved build deps into the /bin/install script New image size is 188mb

@masneyb https://github.com/masneyb @ajmath https://github.com/ajmath @rhussmann https://github.com/rhussmann @kelcecil https://github.com/kelcecil @MichaelRBond https://github.com/MichaelRBond @jdavis92 https://github.com/jdavis92 @alexjpaz https://github.com/alexjpaz @brendangibat https://github.com/brendangibat @jmmartin https://github.com/jmmartin

I think that's all of the people who commented on #34 https://github.com/sstarcher/docker-sensu/pull/34. Could someone test this PR before I merge it.

You can view, comment on, or merge this pull request online at:

https://github.com/sstarcher/docker-sensu/pull/37 Commit Summary

  • Shrinking image size

File Changes

Patch Links:

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sstarcher/docker-sensu/pull/37, or mute the thread https://github.com/notifications/unsubscribe-auth/AAWzdecxN46lz7QPRjTWDkn_uQGG6y8Aks5rU6r_gaJpZM4LqeOR .

sstarcher commented 7 years ago

173.9mb after dropping ruby gem cache/doc

masneyb commented 7 years ago

I tested this against our image and ran into an issue. Here is a snippet of our Dockerfile:

RUN apt-get update && apt-get -y curl # and some other packages
RUN /bin/install mailer pagerduty
# Curl is no longer installed after install runs

On line 6 of your existing Dockerfile, you already install curl and leave it in that layer. I suggest dropping curl from the DEBIAN_TOOLING variable in the install script.

Brian

sstarcher commented 7 years ago

@masneyb what is using curl? Are actual plugins during runtime using it?

masneyb commented 7 years ago

We use curl in our Dockerfile that is based off your image to install additional dependencies.

You install curl in your first RUN command and later delete it in a different layer at the end of the install command. Removing curl at that point won't actually shrink the image size unless the image layers are squashed.

Brian

masneyb commented 7 years ago

Here is an example Dockerfile that is based off your image that illustrates the problem:

FROM this_branches_image_id_from_docker_build
RUN apt-get update && apt-get install -y curl
RUN /bin/install pagerduty
# Curl is no longer installed after /bin/install runs
RUN curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"

Brian

sstarcher commented 7 years ago

@masneyb I'll keep curl installed. Try again

masneyb commented 7 years ago

:shipit: