From 5f52d1f2f905b53be320fc63c48c7b5a378fef7c Mon Sep 17 00:00:00 2001 From: Itxaka Date: Wed, 3 May 2023 21:52:44 +0200 Subject: [PATCH] Store dracut artifacts in its own target So its easier to access them from other places. Alos stores the dracut.conf file for kcryt under the dracut dir and renames it to its proper final name Signed-off-by: Itxaka --- Earthfile | 15 +++++++++++---- dracut.conf => dracut/10-kcrypt.conf | 0 2 files changed, 11 insertions(+), 4 deletions(-) rename dracut.conf => dracut/10-kcrypt.conf (100%) diff --git a/Earthfile b/Earthfile index 41bbe6f..9a8be3b 100644 --- a/Earthfile +++ b/Earthfile @@ -16,13 +16,20 @@ build-kcrypt: RUN CGO_ENABLED=0 go build -o kcrypt -ldflags "-X main.Version=$VERSION" SAVE ARTIFACT /work/kcrypt AS LOCAL kcrypt +dracut-artifacts: + FROM $BASE_IMAGE + WORKDIR /build + COPY --dir dracut/29kcrypt . + COPY dracut/10-kcrypt.conf . + SAVE ARTIFACT 29kcrypt 29kcrypt + SAVE ARTIFACT 10-kcrypt.conf 10-kcrypt.conf + build-dracut: FROM $BASE_IMAGE - COPY . /work - COPY +build-kcrypt/kcrypt /usr/bin/kcrypt WORKDIR /work - RUN cp -r dracut/* /usr/lib/dracut/modules.d - RUN cp dracut.conf /etc/dracut.conf.d/10-kcrypt.conf + COPY +build-kcrypt/kcrypt /usr/bin/kcrypt + COPY +dracut-artifacts/29kcrypt /usr/lib/dracut/modules.d/29kcrypt + COPY +dracut-artifacts/10-kcrypt.conf /etc/dracut.conf.d/10-kcrypt.conf RUN kernel=$(ls /lib/modules | head -n1) && \ dracut -f "/boot/initrd-${kernel}" "${kernel}" && \ ln -sf "initrd-${kernel}" /boot/initrd diff --git a/dracut.conf b/dracut/10-kcrypt.conf similarity index 100% rename from dracut.conf rename to dracut/10-kcrypt.conf