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 d0afe80 commit 56a31b0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 39 deletions.
21 changes: 8 additions & 13 deletions fedora/f37/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,15 @@ LABEL com.github.containers.toolbox="true" \
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 README.md missing-docs extra-packages ensure-files /

COPY missing-docs /
RUN dnf -y reinstall $(<missing-docs)
RUN rm /missing-docs
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 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 \
Expand All @@ -37,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
21 changes: 8 additions & 13 deletions fedora/f38/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,15 @@ LABEL com.github.containers.toolbox="true" \
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 README.md missing-docs extra-packages ensure-files /

COPY missing-docs /
RUN dnf -y reinstall $(<missing-docs)
RUN rm /missing-docs
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 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 \
Expand All @@ -37,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
21 changes: 8 additions & 13 deletions fedora/f39/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,15 @@ LABEL com.github.containers.toolbox="true" \
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 README.md missing-docs extra-packages ensure-files /

COPY missing-docs /
RUN dnf -y reinstall $(<missing-docs)
RUN rm /missing-docs
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 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 \
Expand All @@ -37,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 56a31b0

Please sign in to comment.