mirror of
https://github.com/kairos-io/kairos.git
synced 2025-02-09 05:18:51 +00:00
✨ Refactor Dockerfiles for Ubuntu based flavors (#1656)
* POC with ubuntu dockerfiles Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com> * oops Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com> * Remove comment Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com> --------- Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
This commit is contained in:
parent
81f3280b25
commit
adbba85e77
@ -280,7 +280,11 @@ base-image:
|
||||
ARG BUILD_INITRD="true"
|
||||
IF [ "$BASE_IMAGE" = "" ]
|
||||
# Source the flavor-provided docker file
|
||||
FROM DOCKERFILE --build-arg MODEL=$MODEL -f images/Dockerfile.$FLAVOR .
|
||||
IF [[ "$FLAVOR" =~ ^ubuntu* ]] && [ "$TARGETARCH" != "arm64" ]
|
||||
FROM DOCKERFILE --build-arg MODEL=$MODEL --build-arg FLAVOR=$FLAVOR -f images/Dockerfile.ubuntu .
|
||||
ELSE
|
||||
FROM DOCKERFILE --build-arg MODEL=$MODEL -f images/Dockerfile.$FLAVOR .
|
||||
END
|
||||
ELSE
|
||||
FROM $BASE_IMAGE
|
||||
END
|
||||
|
@ -1,10 +1,15 @@
|
||||
# rolling tag points to the latest release (regardless of LTS status)
|
||||
ARG BASE_IMAGE=ubuntu:rolling
|
||||
ARG FLAVOR
|
||||
|
||||
FROM $BASE_IMAGE
|
||||
# Available flavors
|
||||
FROM ubuntu:rolling AS ubuntu
|
||||
|
||||
FROM ubuntu:20.04 AS ubuntu-20-lts
|
||||
|
||||
FROM ubuntu:22.04 AS ubuntu-22-lts
|
||||
|
||||
# Common packages for all images
|
||||
FROM ${FLAVOR} AS common
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
gnupg \
|
||||
@ -17,17 +22,13 @@ RUN apt-get update \
|
||||
coreutils \
|
||||
cryptsetup \
|
||||
curl \
|
||||
dbus-user-session \
|
||||
debianutils \
|
||||
dmsetup \
|
||||
dosfstools \
|
||||
dracut \
|
||||
dracut-live \
|
||||
dracut-network \
|
||||
e2fsprogs \
|
||||
efibootmgr \
|
||||
firmware-sof-signed \
|
||||
fuse3 \
|
||||
gawk \
|
||||
gdisk \
|
||||
grub2 \
|
||||
@ -41,8 +42,6 @@ RUN apt-get update \
|
||||
isc-dhcp-common \
|
||||
jq \
|
||||
kbd \
|
||||
krb5-locales \
|
||||
linux-image-generic-hwe-22.04 \
|
||||
lvm2 \
|
||||
mdadm \
|
||||
nano \
|
||||
@ -57,9 +56,6 @@ RUN apt-get update \
|
||||
os-prober \
|
||||
packagekit-tools \
|
||||
parted \
|
||||
pigz \
|
||||
pkg-config \
|
||||
polkitd \
|
||||
publicsuffix \
|
||||
qemu-guest-agent \
|
||||
rsync \
|
||||
@ -68,8 +64,6 @@ RUN apt-get update \
|
||||
squashfs-tools \
|
||||
sudo \
|
||||
systemd \
|
||||
systemd-hwe-hwdb \
|
||||
systemd-resolved \
|
||||
systemd-timesyncd \
|
||||
thermald \
|
||||
xdg-user-dirs \
|
||||
@ -80,6 +74,57 @@ RUN apt-get update \
|
||||
zstd \
|
||||
&& apt-get remove -y unattended-upgrades && apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Packages and scripts only for specific images
|
||||
FROM common AS ubuntu-specific
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
dbus-user-session \
|
||||
dracut-live \
|
||||
firmware-sof-signed \
|
||||
fuse3 \
|
||||
krb5-locales \
|
||||
linux-image-generic-hwe-22.04 \
|
||||
pigz \
|
||||
pkg-config \
|
||||
polkitd \
|
||||
systemd-hwe-hwdb \
|
||||
systemd-resolved \
|
||||
&& apt-get remove -y unattended-upgrades && apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
FROM common AS ubuntu-20-lts-specific
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
file \
|
||||
fuse \
|
||||
krb5-locales \
|
||||
linux-image-generic-hwe-20.04 \
|
||||
lldpd \
|
||||
patch \
|
||||
policykit-1 \
|
||||
snmpd \
|
||||
ubuntu-advantage-tools \
|
||||
&& apt-get remove -y unattended-upgrades && apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
FROM common AS ubuntu-22-lts-specific
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
dracut-live \
|
||||
firmware-sof-signed \
|
||||
fuse3 \
|
||||
linux-image-generic-hwe-22.04 \
|
||||
lldpd \
|
||||
pigz \
|
||||
polkitd \
|
||||
snmpd \
|
||||
systemd-hwe-hwdb \
|
||||
ubuntu-advantage-tools \
|
||||
&& apt-get remove -y unattended-upgrades && apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
FROM ${FLAVOR}-specific AS all
|
||||
|
||||
# Generic steps for all images
|
||||
FROM all
|
||||
|
||||
RUN ln -s /usr/sbin/grub-install /usr/sbin/grub2-install
|
||||
RUN ln -s /usr/bin/grub-editenv /usr/bin/grub2-editenv
|
||||
RUN systemctl enable systemd-networkd
|
||||
@ -88,6 +133,5 @@ RUN systemctl enable ssh
|
||||
# Fixup sudo perms
|
||||
RUN chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo
|
||||
|
||||
|
||||
# Clear cache
|
||||
RUN rm -rf /var/cache/* && journalctl --vacuum-size=1K && rm /etc/machine-id && rm /var/lib/dbus/machine-id && rm /etc/hostname
|
||||
|
@ -1,96 +0,0 @@
|
||||
ARG BASE_IMAGE=ubuntu:20.04
|
||||
|
||||
FROM $BASE_IMAGE
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
gnupg \
|
||||
software-properties-common \
|
||||
&& add-apt-repository ppa:oibaf/test \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
conntrack \
|
||||
console-data \
|
||||
coreutils \
|
||||
cryptsetup \
|
||||
curl \
|
||||
debianutils \
|
||||
dmsetup \
|
||||
dosfstools \
|
||||
dracut \
|
||||
dracut-network \
|
||||
e2fsprogs \
|
||||
efibootmgr \
|
||||
file \
|
||||
fuse \
|
||||
gawk \
|
||||
gdisk \
|
||||
grub2 \
|
||||
grub2-common \
|
||||
grub-efi-amd64-bin \
|
||||
grub-efi-amd64-signed \
|
||||
grub-pc-bin \
|
||||
haveged \
|
||||
iproute2 \
|
||||
iptables \
|
||||
isc-dhcp-common \
|
||||
jq \
|
||||
kbd \
|
||||
krb5-locales \
|
||||
linux-image-generic-hwe-20.04 \
|
||||
lldpd \
|
||||
lvm2 \
|
||||
mdadm \
|
||||
nano \
|
||||
nbd-client \
|
||||
ncurses-term \
|
||||
neovim \
|
||||
networkd-dispatcher \
|
||||
nfs-common \
|
||||
open-iscsi \
|
||||
openssh-server \
|
||||
open-vm-tools \
|
||||
os-prober \
|
||||
packagekit-tools \
|
||||
parted \
|
||||
patch \
|
||||
policykit-1 \
|
||||
publicsuffix \
|
||||
qemu-guest-agent \
|
||||
rsync \
|
||||
shared-mime-info \
|
||||
snapd \
|
||||
snmpd \
|
||||
squashfs-tools \
|
||||
sudo \
|
||||
systemd \
|
||||
systemd-timesyncd \
|
||||
thermald \
|
||||
ubuntu-advantage-tools \
|
||||
xdg-user-dirs \
|
||||
xxd \
|
||||
xz-utils \
|
||||
zerofree \
|
||||
zfsutils-linux \
|
||||
zstd \
|
||||
&& apt-get remove -y unattended-upgrades && apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
||||
RUN ln -s /usr/sbin/grub-install /usr/sbin/grub2-install
|
||||
RUN ln -s /usr/bin/grub-editenv /usr/bin/grub2-editenv
|
||||
RUN systemctl enable systemd-networkd
|
||||
RUN systemctl enable ssh
|
||||
|
||||
# workaround https://github.com/kairos-io/kairos/issues/949
|
||||
# TODO: backport patch into packages
|
||||
COPY images/dracut-broken-iscsi-ubuntu-20.patch /
|
||||
RUN cd /usr/lib/dracut/modules.d/95iscsi && patch < /dracut-broken-iscsi-ubuntu-20.patch && rm -rf /dracut-broken-iscsi-ubuntu-20.patch
|
||||
|
||||
# Fixup sudo perms
|
||||
RUN chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo
|
||||
|
||||
|
||||
# Clear cache
|
||||
RUN rm -rf /var/cache/* && journalctl --vacuum-size=1K && rm /etc/machine-id && rm /var/lib/dbus/machine-id && rm /etc/hostname
|
@ -1,92 +0,0 @@
|
||||
ARG BASE_IMAGE=ubuntu:22.04
|
||||
|
||||
FROM $BASE_IMAGE
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
gnupg \
|
||||
software-properties-common \
|
||||
&& add-apt-repository ppa:oibaf/test \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
conntrack \
|
||||
console-data \
|
||||
coreutils \
|
||||
cryptsetup \
|
||||
curl \
|
||||
debianutils \
|
||||
dmsetup \
|
||||
dosfstools \
|
||||
dracut \
|
||||
dracut-live \
|
||||
dracut-network \
|
||||
e2fsprogs \
|
||||
efibootmgr \
|
||||
firmware-sof-signed \
|
||||
fuse3 \
|
||||
gawk \
|
||||
gdisk \
|
||||
grub2 \
|
||||
grub2-common \
|
||||
grub-efi-amd64-bin \
|
||||
grub-efi-amd64-signed \
|
||||
grub-pc-bin \
|
||||
haveged \
|
||||
iproute2 \
|
||||
iptables \
|
||||
isc-dhcp-common \
|
||||
jq \
|
||||
kbd \
|
||||
linux-image-generic-hwe-22.04 \
|
||||
lldpd \
|
||||
lvm2 \
|
||||
mdadm \
|
||||
nano \
|
||||
nbd-client \
|
||||
ncurses-term \
|
||||
neovim \
|
||||
networkd-dispatcher \
|
||||
nfs-common \
|
||||
open-iscsi \
|
||||
openssh-server \
|
||||
open-vm-tools \
|
||||
os-prober \
|
||||
packagekit-tools \
|
||||
parted \
|
||||
qemu-guest-agent \
|
||||
pigz \
|
||||
polkitd \
|
||||
publicsuffix \
|
||||
rsync \
|
||||
shared-mime-info \
|
||||
snapd \
|
||||
snmpd \
|
||||
squashfs-tools \
|
||||
sudo \
|
||||
systemd \
|
||||
systemd-hwe-hwdb \
|
||||
systemd-timesyncd \
|
||||
thermald \
|
||||
ubuntu-advantage-tools \
|
||||
xdg-user-dirs \
|
||||
xxd \
|
||||
xz-utils \
|
||||
zerofree \
|
||||
zfsutils-linux \
|
||||
zstd \
|
||||
&& apt-get remove -y unattended-upgrades && apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN ln -s /usr/sbin/grub-install /usr/sbin/grub2-install
|
||||
RUN ln -s /usr/bin/grub-editenv /usr/bin/grub2-editenv
|
||||
RUN systemctl enable systemd-networkd
|
||||
RUN systemctl enable ssh
|
||||
|
||||
|
||||
# Fixup sudo perms
|
||||
RUN chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo
|
||||
|
||||
|
||||
# Clear cache
|
||||
RUN rm -rf /var/cache/* && journalctl --vacuum-size=1K && rm /etc/machine-id && rm /var/lib/dbus/machine-id && rm /etc/hostname
|
Loading…
Reference in New Issue
Block a user