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
|
2022-01-18 14:10:50 +01:00
|
|
|
# TARGETARCH defined in prjconf, to handle architecture specific bits
|
2022-01-19 08:06:39 +01:00
|
|
|
# since TARGETARCH is not defined in OBS builds yet. Default to amd64.
|
|
|
|
ARG TARGETARCH=amd64
|
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 \
|
|
|
|
augeas \
|
|
|
|
augeas-lenses \
|
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 \
|
2022-12-21 12:49:42 +01:00
|
|
|
ncat \
|
2021-04-20 10:11:31 +02:00
|
|
|
nftables \
|
2022-02-23 15:54:39 +01:00
|
|
|
qemu-hw-usb-redirect \
|
2021-04-20 10:11:31 +02:00
|
|
|
qemu-tools \
|
|
|
|
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 \
|
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
|
|
|
|
RUN if [ "$TARGETARCH" = "amd64" ]; then \
|
2022-01-19 08:06:39 +01:00
|
|
|
zypper -n install qemu-x86 ; \
|
|
|
|
fi;
|
2022-01-18 14:10:50 +01:00
|
|
|
|
|
|
|
#!ArchExclusiveLine: aarch64
|
|
|
|
RUN if [ "$TARGETARCH" = "arm64" ]; then \
|
2022-01-19 08:06:39 +01:00
|
|
|
zypper -n install \
|
2022-01-18 14:10:50 +01:00
|
|
|
qemu-arm \
|
|
|
|
qemu-uefi-aarch64 ; \
|
2022-01-19 08:06:39 +01:00
|
|
|
fi;
|
2022-01-18 14:10:50 +01:00
|
|
|
|
2022-04-27 18:23:34 +02:00
|
|
|
RUN zypper clean -a
|
2020-09-29 17:10:12 +02:00
|
|
|
|
2022-12-21 12:49:42 +01:00
|
|
|
RUN ln -s ncat /usr/bin/nc
|
|
|
|
|
2022-01-18 14:10:50 +01:00
|
|
|
RUN mkdir -p /usr/share/OVMF
|
|
|
|
|
|
|
|
#!ArchExclusiveLine: x86_64
|
|
|
|
RUN if [ "$TARGETARCH" = "amd64" ]; then \
|
2021-05-04 17:34:51 +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 && \
|
2022-01-12 07:34:56 +01:00
|
|
|
ln -s ../qemu/ovmf-x86_64-code.bin /usr/share/OVMF/OVMF_CODE.cc.fd && \
|
2021-05-04 17:34:51 +02:00
|
|
|
ln -s ../qemu/ovmf-x86_64-smm-ms-code.bin /usr/share/OVMF/OVMF_CODE.secboot.fd && \
|
2022-01-18 14:10:50 +01:00
|
|
|
ln -s ../qemu/ovmf-x86_64-smm-ms-vars.bin /usr/share/OVMF/OVMF_VARS.secboot.fd ; \
|
|
|
|
fi;
|
|
|
|
|
|
|
|
#!ArchExclusiveLine: aarch64
|
|
|
|
RUN if [ "$TARGETARCH" = "arm64" ]; then \
|
|
|
|
ln -s ../qemu/aavmf-aarch64-code.bin /usr/share/OVMF/AAVMF_CODE.fd && \
|
|
|
|
ln -s ../qemu/aavmf-aarch64-vars.bin /usr/share/OVMF/AAVMF_VARS.fd ; \
|
|
|
|
fi;
|
2021-05-04 17:34:51 +02:00
|
|
|
|
2022-10-10 19:04:01 +02:00
|
|
|
# KubeVirt expects virtiofsd to be installed in /usr/libexec
|
|
|
|
RUN ls /usr/libexec/virtiofsd || \
|
|
|
|
(mkdir -p /usr/libexec && ln -s ../lib/virtiofsd /usr/libexec/virtiofsd)
|
|
|
|
|
2020-09-29 17:10:12 +02:00
|
|
|
COPY augconf /augconf
|
|
|
|
|
|
|
|
RUN augtool -f /augconf
|
|
|
|
RUN cd /var && rm -rf run && ln -s ../run .
|
|
|
|
|
2022-05-11 06:35:19 +02:00
|
|
|
# Setup permissions and capabilities for non-root VMIs. KubeVirt sets
|
|
|
|
# XDG_* directories to /var/run.
|
|
|
|
RUN setcap 'cap_net_bind_service,cap_sys_ptrace=+ep' /usr/bin/virt-launcher && \
|
2022-12-21 12:49:42 +01:00
|
|
|
setcap 'cap_net_bind_service=+ep' /usr/bin/qemu-system-$(uname -m) && \
|
2022-05-11 06:35:19 +02:00
|
|
|
chmod 0755 /etc/libvirt && \
|
|
|
|
chown qemu:qemu /var/run
|
|
|
|
|
2020-09-29 17:10:12 +02:00
|
|
|
ENTRYPOINT [ "/usr/bin/virt-launcher" ]
|