fedora-toolbox/Dockerfile
Debarshi Ray 6c46178bbb Ensure that documentation and translations are present
This should finally ensure that the fedora-toolbox image doesn't have
any package that had its content, such as documentation or translations,
stripped out by the fedora base image.

Until now, missing-docs had a hand-maintained list of packages that had
their content stripped out by the fedora base image.  These packages are
reinstalled when building the fedora-toolbox image to restore the lost
content.  Unfortunately, this list was incomplete because it was only
updated when someone noticed that something is missing.

Now, the list is generated with:
  $ rpm --all --query --state --queryformat "PACKAGE: %{NAME}\n"

... to ensure that it's always complete.

The existing built-in test to ensure that the desired files are actually
present in the final image was extended to cover some of those that were
absent.  A new built-in test, based on the above rpm(1) command, was
added as a fallback to ensure that the final image doesn't have any
package with missing content.

As suggested by Brian Campbell.

Note that the fedora-toolbox OCI image for Fedora 39 onwards is no
longer built using OpenShift Build Service from the Dockerfile here.
It's now being built using Image Factory from fedora-kickstarts and
pungi-fedora [1], as part of the ToolbxReleaseBlocker Change [2] for
Fedora 39.

Hence this is only for the sake of completeness.

[1] https://pagure.io/fedora-kickstarts/
    https://pagure.io/pungi-fedora/

[2] https://fedoraproject.org/wiki/Changes/ToolbxReleaseBlocker

https://github.com/containers/toolbox/issues/603
2023-11-01 15:36:23 +01:00

54 lines
1.5 KiB
Docker

FROM registry.fedoraproject.org/fedora:39
ARG NAME=fedora-toolbox
ARG VERSION=39
LABEL com.github.containers.toolbox="true" \
com.redhat.component="$NAME" \
name="$NAME" \
version="$VERSION" \
usage="This image is meant to be used with the toolbox command" \
summary="Base image for creating Fedora toolbox containers" \
maintainer="Debarshi Ray <rishi@fedoraproject.org>"
COPY README.md /
RUN rm /etc/rpm/macros.image-language-conf
RUN sed -i '/tsflags=nodocs/d' /etc/dnf/dnf.conf
RUN dnf -y upgrade
RUN dnf -y swap coreutils-single coreutils-full
RUN dnf -y swap glibc-minimal-langpack glibc-all-langpacks
COPY missing-docs /
RUN dnf -y reinstall $(<missing-docs)
RUN rm /missing-docs
COPY extra-packages /
RUN dnf -y install $(<extra-packages)
RUN rm /extra-packages
COPY ensure-files /
RUN ret_val=0; \
while read file; do \
if ! compgen -G "$file" >/dev/null; then \
echo "$file: No such file or directory" >&2; \
ret_val=1; \
break; \
fi; \
done <ensure-files; \
if [ "$ret_val" -ne 0 ]; then \
false; \
fi
RUN rm /ensure-files
RUN broken_packages="$(rpm --all --query --state --queryformat "PACKAGE: %{NAME}\n" \
| sed --quiet --regexp-extended '/PACKAGE: /{s/PACKAGE: // ; h ; b }; /^not installed/ { g; p }' \
| uniq \
| sort)"; \
if [ "$broken_packages" != "" ]; then \
echo "Packages with missing files:" >&2; \
echo "$broken_packages" >&2; \
false; \
fi
RUN dnf clean all