Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated SLEM build script for Kairos v2.4.3 #126

Merged
merged 4 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 8 additions & 55 deletions slem/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 \
Expand All @@ -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) && \
Expand All @@ -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/*
9 changes: 6 additions & 3 deletions slem/README.md
Original file line number Diff line number Diff line change
@@ -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 <REGISTRATION_CODE>
29 changes: 19 additions & 10 deletions slem/build.sh
Original file line number Diff line number Diff line change
@@ -1,30 +1,39 @@
#!/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 <<EOF
[opensuse-oss]
enabled=1
autorefresh=0
baseurl=http://download.opensuse.org/distribution/leap/15.5/repo/oss/
EOF
cd ../..
SUSEConnect -r $REGISTRATION_CODE
systemctl restart docker

#SUSEConnect -r $REGISTRATION_CODE
transactional-update register -r $REGISTRATION_CODE
transactional-update -n pkg install docker
transactional-update -n register -p PackageHub/15.4/x86_64
docker build -t slem-base-image:v243 .

docker build -t slem-base:kairos-v2.4.3 .