2023-10-24 08:12:36 +02:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2020-09-29 17:10:12 +02:00
|
|
|
# Define the tags for OBS and build script builds:
|
2021-03-17 14:43:35 +01:00
|
|
|
#!BuildTag: %%TAGPREFIX%%/virt-launcher:%%PKG_VERSION%%
|
|
|
|
#!BuildTag: %%TAGPREFIX%%/virt-launcher:%%PKG_VERSION%%.%RELEASE%
|
2021-05-04 17:34:51 +02:00
|
|
|
#!BuildTag: %%TAGPREFIX%%/virt-launcher:%%PKG_VERSION%%-%%PKG_RELEASE%%
|
2020-09-29 17:10:12 +02:00
|
|
|
|
2022-01-18 14:10:50 +01:00
|
|
|
#!ExclusiveArch: x86_64 aarch64
|
|
|
|
|
2020-09-29 17:10:12 +02:00
|
|
|
# virt-launcher container image
|
2020-11-18 00:04:10 +01:00
|
|
|
# KUBEVIRTFROM defined in prjconf, e.g.
|
|
|
|
# BuildFlags: dockerarg:KUBEVIRTFROM=opensuse/tumbleweed
|
|
|
|
ARG KUBEVIRTFROM
|
|
|
|
FROM $KUBEVIRTFROM
|
2020-09-29 17:10:12 +02:00
|
|
|
|
2022-08-05 06:57:33 +02:00
|
|
|
# Mandatory labels for the build service:
|
|
|
|
# https://en.opensuse.org/Building_derived_containers
|
2021-03-17 14:43:35 +01:00
|
|
|
# labelprefix=%%LABELPREFIX%%
|
2022-08-05 06:57:33 +02:00
|
|
|
LABEL org.opencontainers.image.title="kubevirt virt-launcher container"
|
|
|
|
LABEL org.opencontainers.image.description="Container to host VM processes for kubevirt"
|
|
|
|
LABEL org.opencontainers.image.created="%BUILDTIME%"
|
|
|
|
LABEL org.opencontainers.image.version="%%PKG_VERSION%%.%RELEASE%"
|
|
|
|
LABEL org.openbuildservice.disturl="%DISTURL%"
|
|
|
|
LABEL org.opensuse.reference="%%REGISTRY%%/%%TAGPREFIX%%/virt-launcher:%%PKG_VERSION%%.%RELEASE%"
|
|
|
|
# endlabelprefix
|
2020-09-29 17:10:12 +02:00
|
|
|
|
2021-04-20 10:11:31 +02:00
|
|
|
RUN zypper -n install \
|
2022-12-21 12:49:42 +01:00
|
|
|
curl \
|
|
|
|
ethtool \
|
|
|
|
gawk \
|
2021-04-20 10:11:31 +02:00
|
|
|
iptables \
|
|
|
|
kubevirt-container-disk \
|
|
|
|
kubevirt-virt-launcher \
|
|
|
|
libcap-progs \
|
|
|
|
libvirt-client \
|
2022-09-01 11:12:50 +02:00
|
|
|
libvirt-daemon-driver-qemu \
|
2024-01-24 08:48:22 +01:00
|
|
|
netcat \
|
2021-04-20 10:11:31 +02:00
|
|
|
nftables \
|
2024-03-19 17:21:06 +01:00
|
|
|
psmisc \
|
|
|
|
qemu-hw-usb-host \
|
2022-02-23 15:54:39 +01:00
|
|
|
qemu-hw-usb-redirect \
|
2023-10-16 11:20:48 +02:00
|
|
|
qemu-img \
|
2021-04-20 10:11:31 +02:00
|
|
|
socat \
|
2021-11-26 07:00:55 +01:00
|
|
|
tar \
|
2021-09-29 18:13:28 +02:00
|
|
|
timezone \
|
2022-04-27 18:23:34 +02:00
|
|
|
vim-small \
|
2023-07-03 08:28:08 +02:00
|
|
|
virtiofsd \
|
2022-01-18 14:10:50 +01:00
|
|
|
xorriso
|
2022-01-19 08:06:39 +01:00
|
|
|
|
2022-01-18 14:10:50 +01:00
|
|
|
#!ArchExclusiveLine: x86_64
|
2023-07-13 13:45:40 +02:00
|
|
|
RUN if [ "$(uname -m)" = "x86_64" ]; then \
|
2024-02-28 08:18:07 +01:00
|
|
|
zypper -n install qemu-x86 && \
|
2024-01-03 13:41:57 +01:00
|
|
|
mkdir -p /usr/share/OVMF && \
|
2023-07-13 13:45:40 +02:00
|
|
|
ln -s ../qemu/ovmf-x86_64-code.bin /usr/share/OVMF/OVMF_CODE.fd && \
|
|
|
|
ln -s ../qemu/ovmf-x86_64-vars.bin /usr/share/OVMF/OVMF_VARS.fd && \
|
|
|
|
ln -s ../qemu/ovmf-x86_64-code.bin /usr/share/OVMF/OVMF_CODE.cc.fd && \
|
|
|
|
ln -s ../qemu/ovmf-x86_64-smm-ms-code.bin /usr/share/OVMF/OVMF_CODE.secboot.fd && \
|
|
|
|
ln -s ../qemu/ovmf-x86_64-smm-ms-vars.bin /usr/share/OVMF/OVMF_VARS.secboot.fd ; \
|
2024-02-28 08:18:07 +01:00
|
|
|
fi
|
2022-01-18 14:10:50 +01:00
|
|
|
|
|
|
|
#!ArchExclusiveLine: aarch64
|
2023-07-13 13:45:40 +02:00
|
|
|
RUN if [ "$(uname -m)" = "aarch64" ]; then \
|
2024-02-28 08:18:07 +01:00
|
|
|
zypper -n install \
|
|
|
|
qemu-arm \
|
|
|
|
qemu-uefi-aarch64 && \
|
2024-01-03 13:41:57 +01:00
|
|
|
mkdir -p /usr/share/AAVMF && \
|
|
|
|
ln -s ../qemu/aavmf-aarch64-code.bin /usr/share/AAVMF/AAVMF_CODE.fd && \
|
|
|
|
ln -s ../qemu/aavmf-aarch64-vars.bin /usr/share/AAVMF/AAVMF_VARS.fd ; \
|
2024-02-28 08:18:07 +01:00
|
|
|
fi
|
2022-10-10 19:04:01 +02:00
|
|
|
|
2024-03-19 18:28:52 +01:00
|
|
|
RUN zypper clean -a
|
|
|
|
|
2024-03-06 13:02:50 +01:00
|
|
|
RUN cp -f /usr/share/kube-virt/virt-launcher/virtqemud.conf /etc/libvirt/virtqemud.conf && \
|
|
|
|
cp -f /usr/share/kube-virt/virt-launcher/qemu.conf /etc/libvirt/qemu.conf
|
2020-09-29 17:10:12 +02:00
|
|
|
|
2024-02-28 08:18:07 +01:00
|
|
|
# KubeVirt expects virtiofsd to be installed in /usr/libexec
|
|
|
|
# NOTE: the value of %{_libexecdir} may vary across distros
|
|
|
|
RUN VIRTIOFSD=$(rpm --eval '%{_libexecdir}')/virtiofsd; \
|
|
|
|
[ -d ${VIRTIOFSD} ] && VIRTIOFSD=${VIRTIOFSD}/virtiofsd; \
|
|
|
|
[ -f /usr/libexec/virtiofsd ] || \
|
|
|
|
(mkdir -p /usr/libexec && ln -svrt /usr/libexec ${VIRTIOFSD})
|
2020-09-29 17:10:12 +02:00
|
|
|
|
2023-11-09 09:43:29 +01:00
|
|
|
# Setup permissions and capabilities for non-root VMIs
|
2023-03-02 09:35:32 +01:00
|
|
|
RUN setcap 'cap_net_bind_service=+ep' /usr/bin/virt-launcher && \
|
|
|
|
setcap 'cap_net_bind_service=+ep' /usr/bin/virt-launcher-monitor && \
|
2022-12-21 12:49:42 +01:00
|
|
|
setcap 'cap_net_bind_service=+ep' /usr/bin/qemu-system-$(uname -m) && \
|
2023-11-09 09:43:29 +01:00
|
|
|
chmod 0755 /etc/libvirt
|
2022-05-11 06:35:19 +02:00
|
|
|
|
2024-02-28 08:18:07 +01:00
|
|
|
RUN cd /var && rm -rf run && ln -s ../run .
|
|
|
|
|
2023-03-02 09:35:32 +01:00
|
|
|
ENTRYPOINT [ "/usr/bin/virt-launcher-monitor" ]
|