Merge pull request #18 from kairos-io/rework_dracut

This commit is contained in:
Itxaka 2023-05-04 14:10:15 +02:00 committed by GitHub
commit f5dc23f554
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 4 deletions

View File

@ -16,13 +16,20 @@ build-kcrypt:
RUN CGO_ENABLED=0 go build -o kcrypt -ldflags "-X main.Version=$VERSION" RUN CGO_ENABLED=0 go build -o kcrypt -ldflags "-X main.Version=$VERSION"
SAVE ARTIFACT /work/kcrypt kcrypt AS LOCAL kcrypt SAVE ARTIFACT /work/kcrypt 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: build-dracut:
FROM $BASE_IMAGE FROM $BASE_IMAGE
COPY . /work
COPY +build-kcrypt/kcrypt /usr/bin/kcrypt
WORKDIR /work WORKDIR /work
RUN cp -r dracut/* /usr/lib/dracut/modules.d COPY +build-kcrypt/kcrypt /usr/bin/kcrypt
RUN cp dracut.conf /etc/dracut.conf.d/10-kcrypt.conf 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) && \ RUN kernel=$(ls /lib/modules | head -n1) && \
dracut -f "/boot/initrd-${kernel}" "${kernel}" && \ dracut -f "/boot/initrd-${kernel}" "${kernel}" && \
ln -sf "initrd-${kernel}" /boot/initrd ln -sf "initrd-${kernel}" /boot/initrd