Introduce RHEL family (#1953)

* Introduce RHEL family

- merges the files for rockylinux and almalinux into a rhel dockerfile
- decided not to add fedora into this since, it requires to add the epel packages, which might make fedora too close to rhel for our community users. But wonder what you think, is it a good/bad idea to try to also merge that one?

Clean up fedora dockerfile

- remove packages which are already installed by default "coreutils" and "curl"
- make it similar to the other dockerfiles for easier maintenance

Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>

* Add fedora to rhel family

Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>

* Introduce inbetween stage for readability

Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>

---------

Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
This commit is contained in:
Mauro Morales 2023-10-26 09:25:05 +02:00 committed by GitHub
parent 1ad015a940
commit bd83ec92e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 132 deletions

12
.github/flavors.json vendored
View File

@ -260,7 +260,7 @@
"worker": "ubuntu-latest"
},
{
"family": "fedora",
"family": "rhel",
"flavor": "fedora",
"flavorRelease": "38",
"variant": "standard",
@ -270,7 +270,7 @@
"worker": "self-hosted"
},
{
"family": "fedora",
"family": "rhel",
"flavor": "fedora",
"flavorRelease": "38",
"variant": "core",
@ -320,7 +320,7 @@
"worker": "self-hosted"
},
{
"family": "rockylinux",
"family": "rhel",
"flavor": "rockylinux",
"flavorRelease": "9",
"variant": "standard",
@ -330,7 +330,7 @@
"worker": "self-hosted"
},
{
"family": "rockylinux",
"family": "rhel",
"flavor": "rockylinux",
"flavorRelease": "9",
"variant": "core",
@ -340,7 +340,7 @@
"worker": "self-hosted"
},
{
"family": "almalinux",
"family": "rhel",
"flavor": "almalinux",
"flavorRelease": "9",
"variant": "standard",
@ -350,7 +350,7 @@
"worker": "self-hosted"
},
{
"family": "almalinux",
"family": "rhel",
"flavor": "almalinux",
"flavorRelease": "9",
"variant": "core",

View File

@ -66,6 +66,7 @@ ci:
ARG --required BASE_IMAGE
ARG --required MODEL
ARG --required VARIANT
ARG --required FAMILY
BUILD +base-image
IF [ "$SECURITY_SCANS" = "true" ]
@ -435,9 +436,9 @@ base-image:
# Set /boot/vmlinuz pointing to our kernel so kairos-agent can use it
# https://github.com/kairos-io/kairos-agent/blob/0288fb111bc568a1bfca59cb09f39302220475b6/pkg/elemental/elemental.go#L548 q
IF [ "$FLAVOR" = "fedora" ] || [ "$FLAVOR" = "rockylinux" ] || [ "$FLAVOR" = "almalinux" ]
RUN rm -rf /boot/initramfs-*
END
# this is generally present on rhel based systems, but it doesn't hurt to remove in any case
RUN rm -rf /boot/initramfs-* || true
IF [ ! -e "/boot/vmlinuz" ]
IF [ -e "/boot/vmlinuz-lts" ]

View File

@ -1,59 +0,0 @@
ARG BASE_IMAGE=almalinux:latest
FROM $BASE_IMAGE
RUN echo "install_weak_deps=False" >> /etc/dnf/dnf.conf
RUN dnf install -y epel-release && dnf clean all
RUN dnf update -y
RUN dnf makecache
RUN dnf install -y \
audit \
cloud-utils-growpart \
device-mapper \
dosfstools \
dracut \
dracut-live \
dracut-network \
dracut-squash \
dhcp-client \
e2fsprogs \
efibootmgr \
epel-release \
gawk \
gdisk \
grub2 \
grub2-efi-x64 \
grub2-efi-x64-modules \
grub2-pc \
kernel \
kernel-modules \
kernel-modules-extra \
livecd-tools \
lvm2 \
nano \
openssh-server \
parted \
polkit \
qemu-guest-agent \
rsync \
shim-x64 \
squashfs-tools \
sudo \
systemd \
systemd-networkd \
systemd-resolved \
systemd-timesyncd \
tar \
which \
https://zfsonlinux.org/epel/zfs-release-2-2.el9.noarch.rpm && dnf clean all
RUN mkdir -p /run/lock
RUN touch /usr/libexec/.keep
RUN systemctl enable getty@tty1.service
RUN systemctl enable getty@tty2.service
RUN systemctl enable getty@tty3.service
RUN systemctl enable systemd-networkd
RUN systemctl enable systemd-resolved
RUN systemctl disable dnf-makecache.service
RUN systemctl enable sshd

View File

@ -1,58 +0,0 @@
# latest is the last stable release, does not include rawhide
ARG BASE_IMAGE=fedora:latest
FROM $BASE_IMAGE
RUN echo "install_weak_deps=False" >> /etc/dnf/dnf.conf
RUN dnf install -y "https://zfsonlinux.org/fedora/zfs-release-2-3$(rpm --eval "%{dist}").noarch.rpm" && dnf clean all
RUN dnf install -y \
audit \
coreutils \
cloud-utils-growpart \
curl \
device-mapper \
dosfstools \
dracut \
dracut-live \
dracut-network \
dracut-squash \
dhcp-client \
e2fsprogs \
efibootmgr \
gawk \
gdisk \
grub2 \
grub2-efi-x64 \
grub2-efi-x64-modules \
grub2-pc \
haveged \
kernel \
kernel-modules \
kernel-modules-extra \
less \
livecd-tools \
lvm2 \
nano \
openssh-server \
parted \
polkit \
qemu-guest-agent \
rsync \
shim-x64 \
squashfs-tools \
sudo \
systemd \
systemd-networkd \
systemd-resolved \
tar \
which \
zfs && dnf clean all
RUN mkdir -p /run/lock && \
touch /usr/libexec/.keep && \
systemctl enable getty@tty1.service && \
systemctl enable getty@tty2.service && \
systemctl enable getty@tty3.service && \
systemctl enable systemd-networkd && \
systemctl enable systemd-resolved && \
systemctl enable sshd

View File

@ -1,10 +1,24 @@
ARG BASE_IMAGE=rockylinux:9
ARG BASE_IMAGE
ARG FLAVOR
FROM $BASE_IMAGE
FROM $BASE_IMAGE AS base
RUN echo "install_weak_deps=False" >> /etc/dnf/dnf.conf
# Install packages according to distro
# epel-packages https://docs.fedoraproject.org/en-US/epel/
FROM base AS epel
RUN dnf install -y epel-release && dnf clean all
RUN dnf install -y "https://zfsonlinux.org/epel/zfs-release-2-3$(rpm --eval "%{dist}").noarch.rpm" && dnf clean all
FROM epel AS almalinux
FROM epel AS rockylinux
FROM base AS fedora
RUN dnf install -y "https://zfsonlinux.org/fedora/zfs-release-2-3$(rpm --eval "%{dist}").noarch.rpm" && dnf clean all
# install common packages
FROM ${FLAVOR} AS common
RUN dnf update -y
RUN dnf makecache
RUN dnf install -y \
@ -19,16 +33,17 @@ RUN dnf install -y \
dhcp-client \
e2fsprogs \
efibootmgr \
epel-release \
gawk \
gdisk \
grub2 \
grub2-efi-x64 \
grub2-efi-x64-modules \
grub2-pc \
haveged \
kernel \
kernel-modules \
kernel-modules-extra \
less \
livecd-tools \
lvm2 \
nano \
@ -43,12 +58,12 @@ RUN dnf install -y \
systemd \
systemd-networkd \
systemd-resolved \
systemd-timesyncd \
tar \
which \
https://zfsonlinux.org/epel/zfs-release-2-2.el9.noarch.rpm \
&& dnf clean all
zfs && dnf clean all
# Final setup
FROM common
RUN mkdir -p /run/lock
RUN touch /usr/libexec/.keep
RUN systemctl enable getty@tty1.service