Skip to content

Don't install docs/weak deps#125

Merged
praiskup merged 1 commit intokonflux-ci:mainfrom
tkopecek:strip-image
Feb 26, 2026
Merged

Don't install docs/weak deps#125
praiskup merged 1 commit intokonflux-ci:mainfrom
tkopecek:strip-image

Conversation

@tkopecek
Copy link
Contributor

Makes image smaller by 60%

@snyk-io
Copy link

snyk-io bot commented Feb 13, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@tkopecek
Copy link
Contributor Author

Original 843MB, this version 342MB. I don't think we want any weak deps. If there is a such rpm we should require it explicitely.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a great optimization to the Containerfile to reduce the final image size by not installing documentation and weak dependencies. The change is effective and follows best practices for building minimal container images. I have provided one suggestion on how this could be made more robust for future modifications to the Containerfile by setting the dnf configuration globally.

Containerfile Outdated

RUN \
dnf -y install mock koji dist-git-client patch python3-norpm python3-specfile redhat-rpm-config acl rpmautospec jq && \
dnf -y --nodocs --setopt=install_weak_deps=False install mock koji dist-git-client patch python3-norpm python3-specfile redhat-rpm-config acl rpmautospec jq && \

Choose a reason for hiding this comment

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

medium

While adding the flags directly to the dnf install command works perfectly for the current state of the file, a more robust and maintainable approach is to configure these settings globally in /etc/dnf/dnf.conf. This ensures that any future dnf install commands added to this Containerfile will automatically benefit from these size-optimizing settings, preventing accidental bloat.

You could modify this RUN instruction to set this up at the beginning:

RUN echo 'install_weak_deps=False' >> /etc/dnf/dnf.conf && \
    echo 'tsflags=nodocs' >> /etc/dnf/dnf.conf && \
    dnf -y install ...

Then, this dnf install command (and any future ones) would not need the explicit flags. This improves the long-term maintainability of the image definition.

@praiskup
Copy link
Member

nice!

Copy link
Member

@praiskup praiskup left a comment

Choose a reason for hiding this comment

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

I'm sure we'll need podman at least. mock recommends those:

btrfs-progs
buildah
dnf-utils
dnf5
dnf5-plugins
fuse-overlayfs
podman
python3-dnf
python3-dnf-plugins-core
yum

Since we rely on "bootstrap image" feature, dnf deps are not needed. Btrfs either.

@praiskup
Copy link
Member

I now checked that buildah isn't used (the plugin that relies on it isn't used in Konflux). We only depend on podman, but ... we might need skopeo (in the future, not now, because rpm-software-management/mock#1642 ).

@tkopecek
Copy link
Contributor Author

Added skopeo

Containerfile Outdated

RUN \
dnf -y install mock koji dist-git-client patch python3-norpm python3-specfile redhat-rpm-config acl rpmautospec jq && \
dnf -y --nodocs --setopt=install_weak_deps=False install mock koji dist-git-client patch python3-norpm python3-specfile redhat-rpm-config acl rpmautospec jq skopeo && \
Copy link
Member

Choose a reason for hiding this comment

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

I think we primarily need podman, but since rpm-software-management/mock#1717 skopeo can be kept

@tkopecek
Copy link
Contributor Author

added also podman (plus linewrap)

@praiskup
Copy link
Member

Needs rebase.

Makes image smaller by 60%
@praiskup praiskup merged commit 6048a11 into konflux-ci:main Feb 26, 2026
11 checks passed
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