Skip to content

Commit 1fbd648

Browse files
chore(core): virt-handler to distroless (#748)
Change virt-handler image to distroless --------- Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
1 parent 652c03e commit 1fbd648

1 file changed

Lines changed: 38 additions & 16 deletions

File tree

images/virt-handler/werf.inc.yaml

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,11 @@
11
---
22
image: {{ $.ImageName }}
3-
fromImage: base-alt-p11
4-
shell:
5-
install:
6-
# Install main packages, update GPG keys and vendor IDs list.
7-
- |
8-
apt-get update && apt-get install --yes \
9-
acl \
10-
procps \
11-
nftables \
12-
qemu-img==9.1.2-alt1 \
13-
xorriso==1.5.6-alt1
14-
- apt-get clean
15-
- rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin
16-
setup:
17-
# Create qemu group and user.
18-
- groupadd --gid 107 qemu && useradd qemu --uid 107 --gid 107 --shell /bin/bash --create-home
3+
fromImage: distroless
194
import:
5+
- image: {{ $.ImageName }}-bins
6+
add: /relocate
7+
to: /
8+
after: install
209
- image: virt-artifact
2110
add: /kubevirt-binaries/
2211
to: /usr/bin
@@ -45,4 +34,37 @@ import:
4534
- nsswitch.conf
4635
# Source https://github.com/kubevirt/kubevirt/blob/v1.3.1/cmd/virt-handler/BUILD.bazel
4736
docker:
37+
USER: 0
4838
ENTRYPOINT: ["/usr/bin/virt-handler"]
39+
40+
---
41+
{{- $binaries := "/usr/bin/bash /usr/bin/rm /usr/bin/grep /usr/bin/qemu-img /usr/bin/qemu-io /usr/bin/qemu-nbd /usr/bin/mount /usr/bin/umount /usr/bin/chacl /usr/bin/getfacl /usr/bin/setfacl /usr/bin/ps /usr/sbin/slabtop /usr/sbin/sysctl /usr/bin/free /usr/bin/pgrep /usr/bin/pidwait /usr/bin/pkill /usr/bin/pmap /usr/bin/pwdx /usr/bin/skill /usr/bin/snice /usr/bin/tload /usr/bin/top /usr/bin/uptime /usr/bin/vmstat /usr/bin/w /usr/bin/watch /usr/sbin/nft /usr/bin/xorriso /usr/bin/xorrecord /usr/bin/osirrox /usr/bin/xorriso-dd-target /usr/bin/xorrisofs" }}
42+
43+
image: {{ $.ImageName }}-bins
44+
final: false
45+
fromImage: base-alt-p11-binaries
46+
shell:
47+
install:
48+
- |
49+
apt-get update && apt-get install --yes \
50+
acl \
51+
procps \
52+
nftables \
53+
qemu-img \
54+
xorriso
55+
- apt-get clean
56+
- rm --recursive --force /var/lib/apt/lists/ftp.altlinux.org* /var/cache/apt/*.bin
57+
setup:
58+
- |
59+
/relocate_binaries.sh -i "{{ $binaries }}" -o /relocate
60+
61+
mkdir -p /relocate/etc /relocate/root
62+
echo "root:x:0:0:root:/root:/bin/bash" >> /relocate/etc/passwd
63+
echo "root:x:0:" >> /relocate/etc/group
64+
echo "root:x:::::::" >> /relocate/etc/shadow
65+
66+
echo "qemu:x:107:107::/home/qemu:/bin/bash" >> /relocate/etc/passwd
67+
echo "qemu:x:107:" >> /relocate/etc/group
68+
mkdir -p /relocate/home/qemu
69+
chown -R 107:107 /relocate/home/qemu
70+

0 commit comments

Comments
 (0)