Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(build): reduce container image size #1336

Merged

Conversation

sthaha
Copy link
Collaborator

@sthaha sthaha commented Apr 10, 2024

This commit reduces container image size by

  1. Removing yum update resulting in more reproducible builds. Updates to the packages are best obtained by pulling a newer base image (which is tested) than running yum update
  2. fixing installation of dcgm only when it is enabled
❯ make build_containerized IMAGE_REPO=quay.io/sthaha CTR_CMD=docker
...
❯ docker images | head -n 5
REPOSITORY                                             TAG                             IMAGE ID       CREATED          SIZE
quay.io/sthaha/kepler                                  latest-dcgm                     ec386bae9d62   8 seconds ago    1.96GB
quay.io/sthaha/kepler                                  v0.7.9-dirty-linux-amd64-dcgm   ec386bae9d62   8 seconds ago    1.96GB
quay.io/sthaha/kepler                                  latest                          ff02e4ae267c   5 minutes ago    390MB
quay.io/sthaha/kepler                                  v0.7.9-dirty-linux-amd64        ff02e4ae267c   5 minutes ago    390MB

This commit reduces container image size by
1. Removing `yum update` resulting in more reproducible builds
2. fixing installation of dcgm only when it is enabled

Signed-off-by: Sunil Thaha <[email protected]>
@sthaha sthaha requested a review from rootfs April 10, 2024 04:16
ARG TARGETARCH

RUN yum -y update
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maryamtahhan
Copy link
Collaborator

maryamtahhan commented Apr 10, 2024

I think #1332 added a check around the DCGM build that was more extensive. please see the image below
Screenshot 2024-04-10 at 13 25 51

But actually looking at quay now it looks like only the no dcgm image :( probably need to check the workflow that's building the images more closely. (I checked the workflow - it appears to build the right thing at least)
But the changes here seem good to me other than leaving yum update

@sthaha
Copy link
Collaborator Author

sthaha commented Apr 10, 2024

But the changes here seem good to me other than leaving yum update

@maryamtahhan , please follow the discussion on https://cloud-native.slack.com/archives/C05QK3KN3HT/p1712723192725319

Yum update in Dockerfile results in builds that are more often than not, irreproducible.

See also:

@rootfs rootfs merged commit 8112a90 into sustainable-computing-io:main Apr 10, 2024
24 checks passed
@rootfs
Copy link
Contributor

rootfs commented Apr 10, 2024

@sthaha there are still something missing, the dcgm container image is not built
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants