From 515b83dedba1b91d3035b68f23679d144b229970 Mon Sep 17 00:00:00 2001 From: Santhosh Date: Sun, 17 Dec 2023 17:41:05 +0530 Subject: [PATCH] sles base image dockerfile (#106) --- README.md | 2 +- slem/Dockerfile | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 slem/Dockerfile diff --git a/README.md b/README.md index 2472e42..045763d 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ do so (now or later) by using -c with the switch command. Example: ```shell cp .arg.template .arg ``` -6. To build RHEL core, RHEL FIPS or Ubuntu fips base images switch to respective directories and build the base image. +6. To build RHEL core, RHEL FIPS or Ubuntu fips, sles base images switch to respective directories and build the base image. The base image built can be passed as argument to build the installer and provider images. Follow the instructions in the respective sub-folders (rhel-fips, ubuntu-fips) to create base images. For ubuntu-fips, this image can be used as base image - `gcr.io/spectro-images-public/ubuntu-focal-fips:v4.0_20230817` diff --git a/slem/Dockerfile b/slem/Dockerfile new file mode 100644 index 0000000..7ce6ad0 --- /dev/null +++ b/slem/Dockerfile @@ -0,0 +1,44 @@ +ARG BASE_IMAGE=registry.suse.com/suse/sle-micro-rancher/5.4:latest +FROM $BASE_IMAGE +ADD repos/SUSE* /etc/zypp/repos.d/ +ADD services/* /etc/zypp/services.d/ +RUN zypper --gpg-auto-import-keys ref +RUN zypper in --force-resolution -y \ + cryptsetup \ + nfs-client \ + kernel-firmware-all \ + systemd-network \ + polkit \ + rng-tools \ + nano \ + && zypper cc +ADD repos/opensuse* /etc/zypp/repos.d/ +RUN zypper --gpg-auto-import-keys ref +RUN zypper in --force-resolution -y --no-allow-vendor-change \ + htop \ + fail2ban \ + lldpd \ + nethogs \ + && zypper cc +# NOTE: removed dhcp-client +RUN mkdir -p /run/lock +RUN mkdir -p /usr/libexec +RUN touch /usr/libexec/.keep +COPY --from=quay.io/kairos/framework:v2.4.3_opensuse-leap / / +# Activate Kairos services +RUN systemctl enable cos-setup-reconcile.timer && \ + systemctl enable cos-setup-fs.service && \ + systemctl enable cos-setup-boot.service && \ + systemctl enable cos-setup-network.service +# Remove /etc/dracut.conf.d/90-kairos-network-legacy.conf to allow dracut to build initrd without dhcp-client +RUN rm -f /etc/dracut.conf.d/90-kairos-network-legacy.conf +## Generate initrd +RUN kernel=$(ls /boot/vmlinuz-* | head -n1) && \ + ln -sf "${kernel#/boot/}" /boot/vmlinuz +RUN kernel=$(ls /lib/modules | head -n1) && \ + dracut -v -N -f "/boot/initrd-${kernel}" "${kernel}" && \ + ln -sf "initrd-${kernel}" /boot/initrd && depmod -a "${kernel}" +RUN kernel=$(ls /lib/modules | head -n1) && dracut -f "/boot/initrd-${kernel}" "${kernel}" && ln -sf "initrd-${kernel}" /boot/initrd +RUN rm -rf /boot/initramfs-* +RUN rm -rf /etc/zypp/repos.d/* +RUN rm -rf /etc/zypp/services.d/* \ No newline at end of file