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

build: update Dockerfile to reduce size #2312

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

robnester-rh
Copy link
Contributor

This commit updates the Dockerfile and Dockerfile.dist to reduce their final image size. This was acheived by:

  • Installing all binaries and ca-certs in a build stage based on ubi-minimal
  • Copying needed files in a build stage based on ubi-micro
  • Combining COPY commands where possible to reduce number of layers generated.

Ref: EC-962

Copy link

codecov bot commented Feb 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.83%. Comparing base (7ecce20) to head (406f306).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2312   +/-   ##
=======================================
  Coverage   72.83%   72.83%           
=======================================
  Files          89       89           
  Lines        7706     7706           
=======================================
  Hits         5613     5613           
  Misses       2093     2093           
Flag Coverage Δ
generative 72.83% <ø> (ø)
integration 72.83% <ø> (ø)
unit 72.83% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@simonbaird
Copy link
Member

Some nitpicks:

  • Removing the git-core is kind of a big deal, but it's just about invisible. Could that be done in a separate commit, either before or after the ubi-micro stuff?
  • To make life easier maintaining two nearly the same files, I always do vimdiff Dockerfile Dockerfile.dist and make sure all the comments and line breaks match exactly. There are some legit real diffs between the two files, but let's not make it harder by adding new spurious diffs like different comments etc.

@simonbaird
Copy link
Member

Also I think there's some work to do with the rpms.lock.yaml.

Firstly, there are a bunch of dependencies there now that we maybe could still need. I'm thinking either those were needed by git-core, so that's why you don't need to copy them over from the minimal to the micro image, or, maybe we do still need to copy them.

(If the "remove git-core" was in a separate commit or PR, it would make it easy to know which it is.)

Running hack/update-rpm-lock.sh refresh the rpm lock file so give it a try.

This commit removes the `git-core package` installation from the
Dockerfile. Removing git-core does require installing the `gzip` pkg
specifically. The `rpms.in.yaml` file has been updated to reflect the
pkgs that need to be installed as well.

Ref: EC-962

Signed-off-by: robnester-rh <[email protected]>
This commit updates the Dockerfile and Dockerfile.dist to reduce their
final image size. This was achieved by:

* Installing all binaries and ca-certs in a build stage based on
  ubi-minimal
* Copying needed files in a build stage based on ubi-micro
* Combining COPY commands where possible to reduce the number of layers
  generated.

Ref: EC-962

Signed-off-by: robnester-rh <[email protected]>
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.

2 participants