Skip to content

Commit

Permalink
fedora: Use fewer layers
Browse files Browse the repository at this point in the history
Merge as many commands as possible together to reduce the amount of
layers used.
  • Loading branch information
travier committed Oct 20, 2023
1 parent ac1a6da commit 0a64b64
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 45 deletions.
23 changes: 8 additions & 15 deletions fedora/f37/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,18 @@ LABEL com.github.containers.toolbox="true" \
summary="Base image for creating Fedora toolbox containers" \
maintainer="Debarshi Ray <[email protected]>"

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 README.md missing-docs extra-packages ensure-files /

COPY extra-packages /
RUN dnf -y install $(<extra-packages)
RUN rm /extra-packages
RUN dnf -y upgrade && \
dnf -y swap coreutils-single coreutils-full && \
dnf -y swap glibc-minimal-langpack glibc-all-langpacks && \
dnf -y reinstall $(<missing-docs) && \
dnf -y install $(<extra-packages) && \
dnf clean all

COPY ensure-files /
RUN ret_val=0; \
while read file; do \
if ! compgen -G "$file" >/dev/null; then \
Expand All @@ -39,6 +33,5 @@ RUN ret_val=0; \
if [ "$ret_val" -ne 0 ]; then \
false; \
fi
RUN rm /ensure-files

RUN dnf clean all
RUN rm /missing-docs /extra-packages /ensure-files
23 changes: 8 additions & 15 deletions fedora/f38/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,18 @@ LABEL com.github.containers.toolbox="true" \
summary="Base image for creating Fedora toolbox containers" \
maintainer="Debarshi Ray <[email protected]>"

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 README.md missing-docs extra-packages ensure-files /

COPY extra-packages /
RUN dnf -y install $(<extra-packages)
RUN rm /extra-packages
RUN dnf -y upgrade && \
dnf -y swap coreutils-single coreutils-full && \
dnf -y swap glibc-minimal-langpack glibc-all-langpacks && \
dnf -y reinstall $(<missing-docs) && \
dnf -y install $(<extra-packages) && \
dnf clean all

COPY ensure-files /
RUN ret_val=0; \
while read file; do \
if ! compgen -G "$file" >/dev/null; then \
Expand All @@ -39,6 +33,5 @@ RUN ret_val=0; \
if [ "$ret_val" -ne 0 ]; then \
false; \
fi
RUN rm /ensure-files

RUN dnf clean all
RUN rm /missing-docs /extra-packages /ensure-files
23 changes: 8 additions & 15 deletions fedora/f39/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,18 @@ LABEL com.github.containers.toolbox="true" \
summary="Base image for creating Fedora toolbox containers" \
maintainer="Debarshi Ray <[email protected]>"

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 README.md missing-docs extra-packages ensure-files /

COPY extra-packages /
RUN dnf -y install $(<extra-packages)
RUN rm /extra-packages
RUN dnf -y upgrade && \
dnf -y swap coreutils-single coreutils-full && \
dnf -y swap glibc-minimal-langpack glibc-all-langpacks && \
dnf -y reinstall $(<missing-docs) && \
dnf -y install $(<extra-packages) && \
dnf clean all

COPY ensure-files /
RUN ret_val=0; \
while read file; do \
if ! compgen -G "$file" >/dev/null; then \
Expand All @@ -39,6 +33,5 @@ RUN ret_val=0; \
if [ "$ret_val" -ne 0 ]; then \
false; \
fi
RUN rm /ensure-files

RUN dnf clean all
RUN rm /missing-docs /extra-packages /ensure-files

0 comments on commit 0a64b64

Please sign in to comment.