Skip to content

Commit 9306206

Browse files
author
SUSE Update Bot
committed
Test build for #3166
1 parent e2478af commit 9306206

File tree

16 files changed

+324
-221
lines changed

16 files changed

+324
-221
lines changed

base-fips-image/Dockerfile

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,25 @@ FROM registry.suse.com/bci/bci-base:15.6
2424

2525
RUN set -euo pipefail; \
2626
zypper -n install --no-recommends sles-release coreutils crypto-policies-scripts
27-
28-
# cleanup logs and temporary files
27+
# image cleanup
2928
RUN set -euo pipefail; zypper -n clean -a; \
30-
rm -rf {/target,}/var/log/{alternatives.log,lastlog,tallylog,zypper.log,zypp/history,YaST2}; \
31-
rm -rf {/target,}/run/*; \
32-
rm -f {/target,}/etc/{shadow-,group-,passwd-,.pwd.lock}; \
33-
rm -f {/target,}/usr/lib/sysimage/rpm/.rpm.lock; \
34-
rm -f {/target,}/var/cache/ldconfig/aux-cache; \
35-
command -v zypper >/dev/null 2>&1 || rm -f /var/lib/zypp/AutoInstalled
36-
37-
# set the day of last password change to empty
38-
RUN set -euo pipefail; sed -i 's/^\([^:]*:[^:]*:\)[^:]*\(:.*\)$/\1\2/' /etc/shadow
29+
rm -vrf /var/log/alternatives.log; \
30+
rm -vrf /var/log/lastlog; \
31+
rm -vrf /var/log/tallylog; \
32+
rm -vrf /var/log/zypper.log; \
33+
rm -vrf /var/log/zypp/history; \
34+
rm -vrf /var/log/YaST2; \
35+
rm -vrf /var/lib/zypp/AnonymousUniqueId; \
36+
rm -vrf /var/cache/zypp/*; \
37+
rm -vrf /run/*; \
38+
rm -vrf /etc/shadow-; \
39+
rm -vrf /etc/group-; \
40+
rm -vrf /etc/passwd-; \
41+
rm -vrf /etc/.pwd.lock; \
42+
rm -vrf /usr/lib/sysimage/rpm/.rpm.lock; \
43+
rm -vrf /var/cache/ldconfig/aux-cache; \
44+
[ -f /var/lib/zypp/AutoInstalled ] && sed -i '1d' /var/lib/zypp/AutoInstalled; \
45+
sed -i 's/^\([^:]*:[^:]*:\)[^:]*\(:.*\)$/\1\2/' /etc/shadow
3946

4047
# Define labels according to https://en.opensuse.org/Building_derived_containers
4148
# labelprefix=com.suse.bci.base-fips

busybox-image/config.sh

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,35 +19,5 @@ fi
1919

2020
sed -i 's|/bin/bash|/bin/sh|' /etc/passwd
2121

22-
# not making sense in a zypper-free image
23-
rm -vf /var/lib/zypp/AutoInstalled
24-
25-
# includes device and inode numbers that change on deploy
26-
rm -vf /var/cache/ldconfig/aux-cache
27-
28-
# Will be recreated by the next rpm(1) run as root user
29-
rm -vf /usr/lib/sysimage/rpm/Index.db
30-
31-
# set the day of last password change to empty
32-
sed -i 's/^\([^:]*:[^:]*:\)[^:]*\(:.*\)$/\1\2/' /etc/shadow
33-
34-
35-
#=======================================
36-
# Clean up after zypper if it is present
37-
#---------------------------------------
38-
if command -v zypper > /dev/null; then
39-
zypper -n clean -a
40-
fi
41-
42-
#=============================================
43-
# Clean up logs and temporary files if present
44-
#---------------------------------------------
45-
rm -rf {/target,}/var/log/{alternatives.log,lastlog,tallylog,zypper.log,zypp/history,YaST2}; \
46-
rm -rf {/target,}/run/*; \
47-
rm -f {/target,}/etc/{shadow-,group-,passwd-,.pwd.lock}; \
48-
rm -f {/target,}/usr/lib/sysimage/rpm/.rpm.lock; \
49-
rm -f {/target,}/var/cache/ldconfig/aux-cache; \
50-
command -v zypper >/dev/null 2>&1 || rm -f /var/lib/zypp/AutoInstalled
51-
5222

5323
exit 0

busybox-image/images.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/sh
2+
# SPDX-License-Identifier: MIT
3+
# SPDX-FileCopyrightText: (c) 2022-2025 SUSE LLC
4+
5+
set -euo pipefail
6+
7+
#======================================
8+
# Image Cleanup
9+
#--------------------------------------
10+
if command -v zypper > /dev/null; then
11+
zypper -n clean -a
12+
# drop timestamp
13+
tail -n +2 /var/lib/zypp/AutoInstalled > /var/lib/zypp/AutoInstalled.new && mv /var/lib/zypp/AutoInstalled.new /var/lib/zypp/AutoInstalled
14+
else
15+
# it does not make sense in a zypper-free image
16+
rm -vrf /var/lib/zypp/AutoInstalled
17+
rm -vrf /usr/lib/sysimage/rpm/Index.db
18+
fi
19+
20+
# set the day of last password change to empty
21+
# prefer sed if available
22+
if command -v sed > /dev/null; then
23+
sed -i 's/^\([^:]*:[^:]*:\)[^:]*\(:.*\)$/\1\2/' /etc/shadow
24+
else
25+
while IFS=: read -r username password last_change min_age max_age warn inactive expire reserved; do
26+
echo "$username:$password::$min_age:$max_age:$warn:$inactive:$expire:$reserved" >> /etc/shadow.new
27+
done < /etc/shadow
28+
mv /etc/shadow.new /etc/shadow
29+
chmod 640 /etc/shadow
30+
fi
31+
32+
# remove logs and temporary files
33+
rm -vrf /var/log/alternatives.log
34+
rm -vrf /var/log/lastlog
35+
rm -vrf /var/log/tallylog
36+
rm -vrf /var/log/zypper.log
37+
rm -vrf /var/log/zypp/history
38+
rm -vrf /var/log/YaST2
39+
rm -vrf /var/lib/zypp/AnonymousUniqueId
40+
rm -vrf /var/cache/zypp/*
41+
rm -vrf /run/*
42+
rm -vrf /etc/shadow-
43+
rm -vrf /etc/group-
44+
rm -vrf /etc/passwd-
45+
rm -vrf /etc/.pwd.lock
46+
rm -vrf /usr/lib/sysimage/rpm/.rpm.lock
47+
rm -vrf /var/cache/ldconfig/aux-cache
48+
49+
50+
exit 0

init-image/Dockerfile

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,25 @@ RUN set -euo pipefail; install -d -m 0755 /etc/systemd/system.conf.d/ \
3030
RUN set -euo pipefail; systemctl disable [email protected]
3131
RUN set -euo pipefail; useradd --no-create-home --uid 497 systemd-coredump
3232

33-
34-
# cleanup logs and temporary files
33+
# image cleanup
3534
RUN set -euo pipefail; zypper -n clean -a; \
36-
rm -rf {/target,}/var/log/{alternatives.log,lastlog,tallylog,zypper.log,zypp/history,YaST2}; \
37-
rm -rf {/target,}/run/*; \
38-
rm -f {/target,}/etc/{shadow-,group-,passwd-,.pwd.lock}; \
39-
rm -f {/target,}/usr/lib/sysimage/rpm/.rpm.lock; \
40-
rm -f {/target,}/var/cache/ldconfig/aux-cache; \
41-
command -v zypper >/dev/null 2>&1 || rm -f /var/lib/zypp/AutoInstalled
42-
43-
# set the day of last password change to empty
44-
RUN set -euo pipefail; sed -i 's/^\([^:]*:[^:]*:\)[^:]*\(:.*\)$/\1\2/' /etc/shadow
35+
rm -vrf /var/log/alternatives.log; \
36+
rm -vrf /var/log/lastlog; \
37+
rm -vrf /var/log/tallylog; \
38+
rm -vrf /var/log/zypper.log; \
39+
rm -vrf /var/log/zypp/history; \
40+
rm -vrf /var/log/YaST2; \
41+
rm -vrf /var/lib/zypp/AnonymousUniqueId; \
42+
rm -vrf /var/cache/zypp/*; \
43+
rm -vrf /run/*; \
44+
rm -vrf /etc/shadow-; \
45+
rm -vrf /etc/group-; \
46+
rm -vrf /etc/passwd-; \
47+
rm -vrf /etc/.pwd.lock; \
48+
rm -vrf /usr/lib/sysimage/rpm/.rpm.lock; \
49+
rm -vrf /var/cache/ldconfig/aux-cache; \
50+
[ -f /var/lib/zypp/AutoInstalled ] && sed -i '1d' /var/lib/zypp/AutoInstalled; \
51+
sed -i 's/^\([^:]*:[^:]*:\)[^:]*\(:.*\)$/\1\2/' /etc/shadow
4552

4653
# Define labels according to https://en.opensuse.org/Building_derived_containers
4754
# labelprefix=com.suse.bci.init

micro-fips-image/Dockerfile

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,28 @@ RUN set -euo pipefail; \
2929

3030
RUN set -euo pipefail; zypper -n install jdupes \
3131
&& jdupes -1 -L -r /target/usr/
32-
33-
# cleanup logs and temporary files
32+
# image cleanup
3433
RUN 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
4454
FROM scratch
4555
COPY --from=builder /target /
4656
# Define labels according to https://en.opensuse.org/Building_derived_containers

micro-image/Dockerfile

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,28 @@ RUN set -euo pipefail; \
2929
RUN set -euo pipefail; rpm --root /target --import /usr/lib/rpm/gnupg/keys/gpg-pubkey-3fa1d6ce-67c856ee.asc
3030
RUN set -euo pipefail; zypper -n install jdupes \
3131
&& jdupes -1 -L -r /target/usr/
32-
33-
# cleanup logs and temporary files
32+
# image cleanup
3433
RUN 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
4454
FROM scratch
4555
COPY --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"
6575
LABEL io.artifacthub.package.readme-url="%SOURCEURL_WITH(README.md)%"
6676
LABEL io.artifacthub.package.logo-url="https://opensource.suse.com/bci/SLE_BCI_logomark_green.svg"
6777
CMD ["/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

minimal-image/config.sh

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -28,36 +28,5 @@ fi
2828
jdupes -1 -L -r /usr/share/licenses
2929
rpm -e jdupes
3030

31-
# set the day of last password change to empty
32-
sed -i 's/^\([^:]*:[^:]*:\)[^:]*\(:.*\)$/\1\2/' /etc/shadow
33-
rpm -e sed
34-
35-
# not making sense in a zypper-free image
36-
rm -vf /var/lib/zypp/AutoInstalled
37-
38-
# includes device and inode numbers that change on deploy
39-
rm -vf /var/cache/ldconfig/aux-cache
40-
41-
# Will be recreated by the next rpm(1) run as root user
42-
rm -vf /usr/lib/sysimage/rpm/Index.db
43-
44-
45-
#=======================================
46-
# Clean up after zypper if it is present
47-
#---------------------------------------
48-
if command -v zypper > /dev/null; then
49-
zypper -n clean -a
50-
fi
51-
52-
#=============================================
53-
# Clean up logs and temporary files if present
54-
#---------------------------------------------
55-
rm -rf {/target,}/var/log/{alternatives.log,lastlog,tallylog,zypper.log,zypp/history,YaST2}; \
56-
rm -rf {/target,}/run/*; \
57-
rm -f {/target,}/etc/{shadow-,group-,passwd-,.pwd.lock}; \
58-
rm -f {/target,}/usr/lib/sysimage/rpm/.rpm.lock; \
59-
rm -f {/target,}/var/cache/ldconfig/aux-cache; \
60-
command -v zypper >/dev/null 2>&1 || rm -f /var/lib/zypp/AutoInstalled
61-
6231

6332
exit 0

minimal-image/images.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
# SPDX-License-Identifier: MIT
3+
# SPDX-FileCopyrightText: (c) 2022-2025 SUSE LLC
4+
5+
set -euo pipefail
6+
7+
#======================================
8+
# Image Cleanup
9+
#--------------------------------------
10+
if command -v zypper > /dev/null; then
11+
zypper -n clean -a
12+
# drop timestamp
13+
tail -n +2 /var/lib/zypp/AutoInstalled > /var/lib/zypp/AutoInstalled.new && mv /var/lib/zypp/AutoInstalled.new /var/lib/zypp/AutoInstalled
14+
else
15+
# it does not make sense in a zypper-free image
16+
rm -vrf /var/lib/zypp/AutoInstalled
17+
rm -vrf /usr/lib/sysimage/rpm/Index.db
18+
fi
19+
20+
# set the day of last password change to empty
21+
# prefer sed if available
22+
if command -v sed > /dev/null; then
23+
sed -i 's/^\([^:]*:[^:]*:\)[^:]*\(:.*\)$/\1\2/' /etc/shadow
24+
else
25+
while IFS=: read -r username password last_change min_age max_age warn inactive expire reserved; do
26+
echo "$username:$password::$min_age:$max_age:$warn:$inactive:$expire:$reserved" >> /etc/shadow.new
27+
done < /etc/shadow
28+
mv /etc/shadow.new /etc/shadow
29+
chmod 640 /etc/shadow
30+
fi
31+
32+
# remove logs and temporary files
33+
rm -vrf /var/log/alternatives.log
34+
rm -vrf /var/log/lastlog
35+
rm -vrf /var/log/tallylog
36+
rm -vrf /var/log/zypper.log
37+
rm -vrf /var/log/zypp/history
38+
rm -vrf /var/log/YaST2
39+
rm -vrf /var/lib/zypp/AnonymousUniqueId
40+
rm -vrf /var/cache/zypp/*
41+
rm -vrf /run/*
42+
rm -vrf /etc/shadow-
43+
rm -vrf /etc/group-
44+
rm -vrf /etc/passwd-
45+
rm -vrf /etc/.pwd.lock
46+
rm -vrf /usr/lib/sysimage/rpm/.rpm.lock
47+
rm -vrf /var/cache/ldconfig/aux-cache
48+
49+
50+
exit 0

minimal-image/minimal-image.kiwi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ You can contact the BCI team via https://github.com/SUSE/bci/discussions
7575
<package name="skelcd-EULA-bci"/>
7676
<package name="sles-release"/>
7777
<package name="jdupes"/>
78-
<package name="sed"/>
7978
<package name="rpm-ndb"/>
8079
<package name="perl-base"/>
8180
</packages>

nodejs-20-image/Dockerfile

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,25 @@ FROM registry.suse.com/bci/bci-base:15.6
2727

2828
RUN set -euo pipefail; \
2929
zypper -n install --no-recommends nodejs20 npm20 update-alternatives curl findutils gawk git-core procps
30-
31-
# cleanup logs and temporary files
30+
# image cleanup
3231
RUN set -euo pipefail; zypper -n clean -a; \
33-
rm -rf {/target,}/var/log/{alternatives.log,lastlog,tallylog,zypper.log,zypp/history,YaST2}; \
34-
rm -rf {/target,}/run/*; \
35-
rm -f {/target,}/etc/{shadow-,group-,passwd-,.pwd.lock}; \
36-
rm -f {/target,}/usr/lib/sysimage/rpm/.rpm.lock; \
37-
rm -f {/target,}/var/cache/ldconfig/aux-cache; \
38-
command -v zypper >/dev/null 2>&1 || rm -f /var/lib/zypp/AutoInstalled
39-
40-
# set the day of last password change to empty
41-
RUN set -euo pipefail; sed -i 's/^\([^:]*:[^:]*:\)[^:]*\(:.*\)$/\1\2/' /etc/shadow
32+
rm -vrf /var/log/alternatives.log; \
33+
rm -vrf /var/log/lastlog; \
34+
rm -vrf /var/log/tallylog; \
35+
rm -vrf /var/log/zypper.log; \
36+
rm -vrf /var/log/zypp/history; \
37+
rm -vrf /var/log/YaST2; \
38+
rm -vrf /var/lib/zypp/AnonymousUniqueId; \
39+
rm -vrf /var/cache/zypp/*; \
40+
rm -vrf /run/*; \
41+
rm -vrf /etc/shadow-; \
42+
rm -vrf /etc/group-; \
43+
rm -vrf /etc/passwd-; \
44+
rm -vrf /etc/.pwd.lock; \
45+
rm -vrf /usr/lib/sysimage/rpm/.rpm.lock; \
46+
rm -vrf /var/cache/ldconfig/aux-cache; \
47+
[ -f /var/lib/zypp/AutoInstalled ] && sed -i '1d' /var/lib/zypp/AutoInstalled; \
48+
sed -i 's/^\([^:]*:[^:]*:\)[^:]*\(:.*\)$/\1\2/' /etc/shadow
4249

4350
# Define labels according to https://en.opensuse.org/Building_derived_containers
4451
# labelprefix=com.suse.bci.nodejs

0 commit comments

Comments
 (0)