Skip to content

Commit

Permalink
Move logic for opensuse
Browse files Browse the repository at this point in the history
Signed-off-by: Mauro Morales <[email protected]>
  • Loading branch information
mauromorales committed Nov 17, 2023
1 parent 424cde4 commit 9ea4c4d
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 1 deletion.
1 change: 1 addition & 0 deletions images/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ RUN rc-update add sshd boot && \
RUN ln -s /usr/sbin/grub-install /usr/sbin/grub2-install && \
ln -s /usr/bin/grub-editenv /usr/bin/grub2-editenv

# Originally done in Earthly
COPY --from=framework / /

RUN rm -rf /etc/ssh/ssh_host_*
Expand Down
80 changes: 79 additions & 1 deletion images/Dockerfile.opensuse
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
###############################################################
#### ARGS ####
###############################################################
ARG FLAVOR
ARG FLAVOR_RELEASE
ARG MODEL=generic
ARG BASE_IMAGE
ARG FLAVOR_RELEASE
ARG VARIANT
ARG VERSION
ARG FRAMEWORK_VERSION=master
# Not to be confused with the concept of MODEL, this is either fips or generic
ARG SECURITY_PROFILE=generic
# TARGETARCH is used to determine the architecture of the image
# it is already set by Docker so it doesn't need to be defined here

FROM $BASE_IMAGE AS base

Expand Down Expand Up @@ -140,6 +148,8 @@ FROM rpicommon AS rpi-tumbleweed
FROM rpi-${FLAVOR_RELEASE} AS rpi3
FROM rpi-${FLAVOR_RELEASE} AS rpi4

FROM quay.io/kairos/framework:${FRAMEWORK_VERSION}_${SECURITY_PROFILE} AS framework

###############################################################
#### Post-Process Common to All ####
###############################################################
Expand All @@ -149,3 +159,71 @@ FROM ${MODEL} AS all
RUN zypper in --force-resolution -y \
kernel-default \
&& zypper cc
# Originally done in Earthly
COPY --from=framework / /

RUN rm -rf /etc/ssh/ssh_host_*

COPY naming.sh /usr/local/bin/naming.sh

RUN sed -i -n '/KAIROS_/!p' /etc/os-release

# need to be defined after FROM for them to be replaced in the RUN bellow
ARG FLAVOR
ARG FLAVOR_RELEASE
ARG VARIANT
ARG OS_ID=kairos
ARG HOME_URL="https://github.com/kairos-io/kairos"
ARG BUG_REPORT_URL="https://github.com/kairos-io/kairos/issues"
ARG GITHUB_REPO="kairos-io/kairos"
# TODO: merge these
ARG VERSION
ARG FAMILY
ARG MODEL
ARG REGISTRY_AND_ORG="quay.io/kairos"
ARG K3S_VERSION
ARG TARGETARCH
ARG OS_NAME=kairos-${VARIANT}-${FLAVOR}-${FLAVOR_RELEASE}
ENV KAIROS_VERSION="${VERSION}${K3S_VERSION:+-k3s$K3S_VERSION}"
ENV OS_VERSION=${KAIROS_VERSION}
ENV OS_LABEL=${KAIROS_VERSION}
RUN OS_LABEL=$(naming.sh container_artifact_label) \
OS_REPO=$(naming.sh container_artifact_repo) \
ARTIFACT=$(naming.sh bootable_artifact_name) \
envsubst >>/etc/os-release </usr/lib/os-release.tmpl
RUN naming.sh container_artifact_name > /IMAGE

# TODO no benefit of keaping it?
# RUN rm /usr/local/bin/naming.sh

RUN rm -rf /etc/machine-id

# TODO dev kairos-agent?
# TODO dev immucore?
# TODO dev kcrypt?
# TODO latest k3s?

FROM all AS core

FROM all AS standard
ARG K3S_VERSION
RUN luet install -y system/provider-kairos
RUN luet install -y $(echo k8s/k3s-systemd@${K3S_VERSION}) utils/edgevpn utils/k9s utils/nerdctl container/kubectl utils/kube-vip
RUN luet database get-all-installed --output /etc/kairos/versions.yaml

FROM ${VARIANT} AS final

# TODO what about NOT building initrd for the UKI?
# TODO what about caches?
RUN kernel=$(ls /lib/modules | head -n1) && depmod -a "${kernel}"
# Regenerate initrd if necessary
RUN if [ -f "/usr/bin/dracut" ]; then \
kernel=$(ls /lib/modules | head -n1) && \
dracut -f "/boot/initrd-${kernel}" "${kernel}" && \
ln -sf "initrd-${kernel}" /boot/initrd; \
fi
# Proper config files with immucore and custom initrd should already be in there installed by framework
RUN if [ -f "/sbin/mkinitfs" ]; then \
kernel=$(ls /lib/modules | head -n1) && \
mkinitfs -o /boot/initrd "${kernel}"; \
fi

0 comments on commit 9ea4c4d

Please sign in to comment.