diff --git a/slem/Dockerfile b/slem/Dockerfile index eed39be..31ca407 100644 --- a/slem/Dockerfile +++ b/slem/Dockerfile @@ -1,5 +1,6 @@ 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 @@ -11,7 +12,9 @@ RUN zypper in --force-resolution -y \ polkit \ rng-tools \ nano \ + growpart \ && 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 \ @@ -24,63 +27,11 @@ RUN zypper in --force-resolution -y --no-allow-vendor-change \ 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 / / -RUN mkdir -p /etc/dnf -RUN echo "install_weak_deps=False" > /etc/dnf/dnf.conf +COPY --from=quay.io/kairos/framework:v2.4.3_generic / / -RUN zypper in --force-resolution -y \ - bash-completion \ - conntrack-tools \ - coreutils \ - curl \ - device-mapper \ - dhcp-client \ - dosfstools \ - dracut \ - e2fsprogs \ - fail2ban \ - findutils \ - gawk \ - growpart \ - gptfdisk \ - haveged \ - htop \ - iproute2 \ - iptables \ - iputils \ - issue-generator \ - jq \ - less \ - logrotate \ - lsscsi \ - lvm2 \ - mdadm \ - multipath-tools \ - nano \ -# nohang \ - open-iscsi \ - openssh \ - open-vm-tools \ - parted \ - pigz \ - policycoreutils \ - polkit \ - procps \ - rng-tools \ - rsync \ - squashfs \ - strace \ - sudo \ - systemd \ - systemd-network \ - tar \ - timezone \ - tmux \ - vim \ - which \ - tpm2* \ - && zypper cc \ +# Remove file below to allow dracut to build initrd without dhcp-client +RUN rm -rf /usr/lib/dracut/modules.d/35network-legacy ## Generate initrd RUN kernel=$(ls /boot/vmlinuz-* | head -n1) && \ @@ -89,6 +40,8 @@ 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 + +# Cleanup 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 diff --git a/slem/README.md b/slem/README.md index db10e57..3c73647 100644 --- a/slem/README.md +++ b/slem/README.md @@ -1,6 +1,9 @@ -# slem +# SUSE Linux Enterprise Micro -slem base image needs to built on the slem server. -A registration code is need to build the slem base image. +## Pre-requisites : +* A host with SLES Micro distribution installed +* Registration code to register with SUSEConnect +* If you wish to override the BASE_IMAGE, make sure to use a container image that has zypper installed in it +## Steps to build the image: ./build.sh diff --git a/slem/build.sh b/slem/build.sh index 0832ceb..1e9bffd 100644 --- a/slem/build.sh +++ b/slem/build.sh @@ -1,20 +1,29 @@ #!/bin/bash +if [[ -z "$1" ]]; then + echo "ERROR : Registration code is empty !" + echo "Re-run this utility with SUSE Registration code in the args." + echo "Example : ./build.sh 123456789" + exit 1 +fi +REGISTRATION_CODE=$1 + set -ex -REGISTRATION_CODE=$1 -mkdir /var/slem +mkdir -p /var/slem +yes | cp ./Dockerfile /var/slem cd /var/slem -mkdir repos -mkdir services +mkdir -p repos +mkdir -p services cd repos/ -mkdir SUSE -mkdir opensuse +mkdir -p SUSE +mkdir -p opensuse cd SUSE cp /etc/zypp/repos.d/SUSE*.repo . cd ../../services/ cp /etc/zypp/services.d/*.service . cd ../repos/opensuse/ + cat > opensuse-oss.repo <