@@ -29,18 +29,28 @@ RUN set -euo pipefail; \
2929RUN set -euo pipefail; rpm --root /target --import /usr/lib/rpm/gnupg/keys/gpg-pubkey-3fa1d6ce-67c856ee.asc
3030RUN set -euo pipefail; zypper -n install jdupes \
3131 && jdupes -1 -L -r /target/usr/
32-
33- # cleanup logs and temporary files
32+ # image cleanup
3433RUN set -euo pipefail; zypper -n --installroot /target clean -a; \
35- rm -rf {/target,}/var/log/{alternatives.log,lastlog,tallylog,zypper.log,zypp/history,YaST2}; \
36- rm -rf {/target,}/run/*; \
37- rm -f {/target,}/etc/{shadow-,group-,passwd-,.pwd.lock}; \
38- rm -f {/target,}/usr/lib/sysimage/rpm/.rpm.lock; \
39- rm -f {/target,}/var/cache/ldconfig/aux-cache; \
40- command -v zypper >/dev/null 2>&1 || rm -f /var/lib/zypp/AutoInstalled
34+ rm -vrf /target/var/log/alternatives.log; \
35+ rm -vrf /target/var/log/lastlog; \
36+ rm -vrf /target/var/log/tallylog; \
37+ rm -vrf /target/var/log/zypper.log; \
38+ rm -vrf /target/var/log/zypp/history; \
39+ rm -vrf /target/var/log/YaST2; \
40+ rm -vrf /target/var/lib/zypp/AnonymousUniqueId; \
41+ rm -vrf /target/var/cache/zypp/*; \
42+ rm -vrf /target/run/*; \
43+ rm -vrf /target/etc/shadow-; \
44+ rm -vrf /target/etc/group-; \
45+ rm -vrf /target/etc/passwd-; \
46+ rm -vrf /target/etc/.pwd.lock; \
47+ rm -vrf /target/usr/lib/sysimage/rpm/.rpm.lock; \
48+ rm -vrf /target/var/cache/ldconfig/aux-cache; \
49+ rm -vrf /target/var/lib/zypp/AutoInstalled; \
50+ rm -vrf /target/usr/lib/sysimage/rpm/Index.db; \
51+ [ -f /var/lib/zypp/AutoInstalled ] && sed -i '1d' /var/lib/zypp/AutoInstalled; \
52+ sed -i 's/^\( [^:]*:[^:]*:\) [^:]*\( :.*\) $/\1\2 /' /target/etc/shadow
4153
42- # set the day of last password change to empty
43- RUN set -euo pipefail; sed -i 's/^\( [^:]*:[^:]*:\) [^:]*\( :.*\) $/\1\2 /' /target/etc/shadow
4454FROM scratch
4555COPY --from=builder /target /
4656# Define labels according to https://en.opensuse.org/Building_derived_containers
@@ -65,8 +75,3 @@ LABEL com.suse.release-stage="released"
6575LABEL io.artifacthub.package.readme-url="%SOURCEURL_WITH(README.md)%"
6676LABEL io.artifacthub.package.logo-url="https://opensource.suse.com/bci/SLE_BCI_logomark_green.svg"
6777CMD ["/bin/sh" ]
68-
69- # not making sense in a zypper-free image
70- RUN set -euo pipefail; rm -vf /var/lib/zypp/AutoInstalled
71- # includes device and inode numbers that change on deploy
72- RUN set -euo pipefail; rm -vf /var/cache/ldconfig/aux-cache
0 commit comments