Skip to content

Commit

Permalink
Framework changes and luet versions
Browse files Browse the repository at this point in the history
Signed-off-by: Mauro Morales <[email protected]>
  • Loading branch information
mauromorales committed Nov 27, 2023
1 parent 6f564ee commit 85d279a
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 16 deletions.
22 changes: 16 additions & 6 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -316,14 +316,15 @@ build-framework-image:
ARG _SECUIRTY_PROFILE=generic
END


COPY +version/VERSION ./
ARG VERSION=$(cat VERSION)
DO +GIT_VERSION

IF [ "$VERSION" ~= ".*dirty.*" ]
ARG FRAMEWORK_VERSION=master
ELSE
ARG VERSION=$(cat ./GIT_VERSION)

IF [ "$VERSION" ~= "v\d+\.\d+\d+" ]
ARG FRAMEWORK_VERSION=$VERSION
ELSE
ARG FRAMEWORK_VERSION=master
END

ARG _IMG="$IMAGE_REPOSITORY_ORG/framework:${FRAMEWORK_VERSION}_${_SECUIRTY_PROFILE}"
Expand All @@ -335,7 +336,7 @@ build-framework-image:

COPY (+framework/framework --SECURITY_PROFILE=$_SECUIRTY_PROFILE) /

SAVE IMAGE --push $IMAGE_REPOSITORY_ORG/framework:${VERSION}_${_SECUIRTY_PROFILE}
SAVE IMAGE --push $IMAGE_REPOSITORY_ORG/framework:${FRAMEWORK_VERSION}_${_SECUIRTY_PROFILE}

no-base-image:
ARG TARGETARCH # Earthly built-in (not passed)
Expand All @@ -356,6 +357,12 @@ no-base-image:

ARG KAIROS_VERSION=$(cat ./GIT_VERSION)

IF [ "$KAIROS_VERSION" ~= "v\d+\.\d+\d+" ]
ARG FRAMEWORK_VERSION=$KAIROS_VERSION
ELSE
ARG FRAMEWORK_VERSION=master
END

FROM DOCKERFILE \
--build-arg BASE_IMAGE=$BASE_IMAGE \
--build-arg MODEL=$MODEL \
Expand All @@ -365,10 +372,12 @@ no-base-image:
--build-arg VARIANT=$VARIANT \
--build-arg VERSION=$KAIROS_VERSION \
--build-arg K3S_VERSION=$K3S_VERSION \
--build-arg FRAMEWORK_VERSION=master \
-f images/Dockerfile.$FAMILY images/

COPY +version/VERSION ./
ARG _CIMG=$(cat ./IMAGE)

SAVE IMAGE $_CIMG
SAVE ARTIFACT /IMAGE AS LOCAL build/IMAGE
SAVE ARTIFACT VERSION AS LOCAL build/VERSION
Expand Down Expand Up @@ -557,6 +566,7 @@ base-image:
image-rootfs:
ARG --required FAMILY
ARG --required FLAVOR
ARG --required FLAVOR_RELEASE
ARG --required BASE_IMAGE
ARG --required MODEL
ARG --required VARIANT
Expand Down
4 changes: 2 additions & 2 deletions images/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,11 @@ FROM all AS standard
ARG K3S_VERSION
RUN luet install -y system/provider-kairos
RUN luet install -y 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

SHELL ["/bin/ash", "-o", "pipefail", "-c"]
RUN luet database get-all-installed --output /etc/kairos/versions.yaml

RUN kernel=$(ls /lib/modules | head -n1) && depmod -a "${kernel}"
# Regenerate initrd if necessary
RUN if [ -f "/usr/bin/dracut" ]; then \
Expand Down
4 changes: 2 additions & 2 deletions images/Dockerfile.debian
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,11 @@ FROM all AS standard
ARG K3S_VERSION
RUN luet install -y system/provider-kairos
RUN luet install -y 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

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN luet database get-all-installed --output /etc/kairos/versions.yaml

# TODO what about NOT building initrd for the UKI?
RUN rm -rf /boot/initrd.img-*
# TODO what about caches?
Expand Down
4 changes: 2 additions & 2 deletions images/Dockerfile.opensuse
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,11 @@ FROM all AS standard
ARG K3S_VERSION
RUN luet install -y system/provider-kairos
RUN luet install -y 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

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN luet database get-all-installed --output /etc/kairos/versions.yaml

# TODO what about NOT building initrd for the UKI?
# TODO what about caches?
RUN kernel=$(ls /lib/modules | head -n1) && depmod -a "${kernel}"
Expand Down
4 changes: 2 additions & 2 deletions images/Dockerfile.rhel
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ FROM all AS standard
ARG K3S_VERSION
RUN luet install -y system/provider-kairos
RUN luet install -y 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

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN luet database get-all-installed --output /etc/kairos/versions.yaml

# TODO what about NOT building initrd for the UKI?
# TODO what about caches?
RUN kernel=$(ls /lib/modules | head -n1) && depmod -a "${kernel}"
Expand Down
5 changes: 3 additions & 2 deletions images/Dockerfile.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ RUN apt-get update \
dracut-network \
e2fsprogs \
fdisk \
file \
gawk \
gdisk \
grub2-common \
Expand Down Expand Up @@ -240,7 +241,7 @@ RUN apt-get update \



FROM quay.io/kairos/framework:${FRAMEWORK_VERSION}_${SECURITY_PROFILE} AS framework
FROM --platform=${TARGETARCH} quay.io/kairos/framework:${FRAMEWORK_VERSION}_${SECURITY_PROFILE} AS framework

###############################################################
#### Post-Process Common to All ####
Expand Down Expand Up @@ -307,10 +308,10 @@ FROM all AS standard
ARG K3S_VERSION
RUN luet install -y system/provider-kairos
RUN luet install -y 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
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN luet database get-all-installed --output /etc/kairos/versions.yaml
# compress firmware
RUN find /usr/lib/firmware -type f -execdir zstd --rm -9 {} \+
# compress modules
Expand Down

0 comments on commit 85d279a

Please sign in to comment.