From d6b80396bbf599d7781ac0abb7322b862c888c83 Mon Sep 17 00:00:00 2001 From: Avi Deitcher Date: Mon, 15 Apr 2019 11:23:53 +0300 Subject: [PATCH] Move coreos-grub build to its own image Signed-off-by: Avi Deitcher --- tools/grub/Dockerfile | 44 ++++++++++++++++++++++++++++++ tools/grub/build.yml | 5 ++++ tools/mkimage-iso-efi/Dockerfile | 44 ++---------------------------- tools/mkimage-qcow2-efi/Dockerfile | 44 ++---------------------------- tools/mkimage-raw-efi/Dockerfile | 43 ++--------------------------- 5 files changed, 58 insertions(+), 122 deletions(-) create mode 100644 tools/grub/Dockerfile create mode 100644 tools/grub/build.yml diff --git a/tools/grub/Dockerfile b/tools/grub/Dockerfile new file mode 100644 index 000000000..2ca756870 --- /dev/null +++ b/tools/grub/Dockerfile @@ -0,0 +1,44 @@ +FROM linuxkit/alpine:3683c9a66cd4da40bd7d6c7da599b2dcd738b559 AS grub-build +RUN apk add \ + automake \ + make \ + bison \ + gettext \ + flex \ + gcc \ + git \ + libtool \ + libc-dev \ + linux-headers \ + python3 \ + autoconf + +# because python is not available +RUN ln -s python3 /usr/bin/python + +ENV GRUB_MODULES="part_gpt fat ext2 iso9660 gzio linux acpi normal cpio crypto disk boot crc64 gpt \ +search_disk_uuid tftp verify xzio xfs video" +ENV GRUB_COMMIT=d3fd939f18446b05d1d5456f23823498a1eb3fb4 + +RUN mkdir /grub-lib && \ + set -e && \ + git clone https://github.com/coreos/grub.git && \ + cd grub && \ + git checkout -b grub-build ${GRUB_COMMIT} && \ + ./autogen.sh && \ + ./configure --libdir=/grub-lib --with-platform=efi CFLAGS="-Os -Wno-unused-value" && \ + make -j "$(getconf _NPROCESSORS_ONLN)" && \ + make install && \ + case $(uname -m) in \ + x86_64) \ + ./grub-mkimage -O x86_64-efi -d /grub-lib/grub/x86_64-efi -o /grub-lib/BOOTX64.EFI -p /EFI/BOOT ${GRUB_MODULES} linuxefi; \ + ;; \ + aarch64) \ + ./grub-mkimage -O arm64-efi -d /grub-lib/grub/arm64-efi -o /grub-lib/BOOTAA64.EFI -p /EFI/BOOT ${GRUB_MODULES}; \ + ;; \ + esac + +FROM scratch +ENTRYPOINT [] +WORKDIR / +COPY --from=grub-build /grub-lib/*.EFI / diff --git a/tools/grub/build.yml b/tools/grub/build.yml new file mode 100644 index 000000000..8e32e6a78 --- /dev/null +++ b/tools/grub/build.yml @@ -0,0 +1,5 @@ +image: grub +network: true +arches: + - arm64 + - amd64 diff --git a/tools/mkimage-iso-efi/Dockerfile b/tools/mkimage-iso-efi/Dockerfile index f13685161..04178e809 100644 --- a/tools/mkimage-iso-efi/Dockerfile +++ b/tools/mkimage-iso-efi/Dockerfile @@ -1,44 +1,6 @@ -FROM linuxkit/alpine:3683c9a66cd4da40bd7d6c7da599b2dcd738b559 AS grub-build -RUN apk add \ - automake \ - make \ - bison \ - gettext \ - flex \ - gcc \ - git \ - libtool \ - libc-dev \ - linux-headers \ - python3 \ - autoconf +FROM linuxkit/grub:a4ba33f2ef880947862eaaeceadb2a51bfebb688 AS grub -# because python is not available -RUN ln -s python3 /usr/bin/python - -ENV GRUB_MODULES="part_gpt fat ext2 iso9660 gzio linux acpi normal cpio crypto disk boot crc64 gpt \ -search_disk_uuid tftp verify xzio xfs video" -ENV GRUB_COMMIT=d3fd939f18446b05d1d5456f23823498a1eb3fb4 - -RUN mkdir /grub-lib && \ - set -e && \ - git clone https://github.com/coreos/grub.git && \ - cd grub && \ - git checkout -b grub-build ${GRUB_COMMIT} && \ - ./autogen.sh && \ - ./configure --libdir=/grub-lib --with-platform=efi CFLAGS="-Os -Wno-unused-value" && \ - make -j "$(getconf _NPROCESSORS_ONLN)" && \ - make install && \ - case $(uname -m) in \ - x86_64) \ - ./grub-mkimage -O x86_64-efi -d /grub-lib/grub/x86_64-efi -o /grub-lib/BOOTX64.EFI -p /EFI/BOOT ${GRUB_MODULES} linuxefi; \ - ;; \ - aarch64) \ - ./grub-mkimage -O arm64-efi -d /grub-lib/grub/arm64-efi -o /grub-lib/BOOTAA64.EFI -p /EFI/BOOT ${GRUB_MODULES}; \ - ;; \ - esac - -FROM linuxkit/alpine:3683c9a66cd4da40bd7d6c7da599b2dcd738b559 AS mirror +FROM linuxkit/alpine:518c2ed0f398c5508969ac5e033607201fb419ed AS mirror RUN mkdir -p /out/etc/apk && cp -r /etc/apk/* /out/etc/apk/ RUN apk add --no-cache --initdb -p /out \ alpine-baselayout \ @@ -54,6 +16,6 @@ RUN mv /out/etc/apk/repositories.upstream /out/etc/apk/repositories FROM scratch WORKDIR / COPY --from=mirror /out/ / -COPY --from=grub-build /grub-lib/BOOT*.EFI /usr/local/share/ +COPY --from=grub /BOOT*.EFI /usr/local/share/ COPY . . ENTRYPOINT [ "/make-efi" ] diff --git a/tools/mkimage-qcow2-efi/Dockerfile b/tools/mkimage-qcow2-efi/Dockerfile index 93917acd3..2d014e366 100644 --- a/tools/mkimage-qcow2-efi/Dockerfile +++ b/tools/mkimage-qcow2-efi/Dockerfile @@ -1,44 +1,6 @@ -FROM linuxkit/alpine:3683c9a66cd4da40bd7d6c7da599b2dcd738b559 AS grub-build -RUN apk add \ - autoconf \ - automake \ - bison \ - gcc \ - gettext \ - git \ - flex \ - libc-dev \ - libtool \ - linux-headers \ - make \ - python3 +FROM linuxkit/grub:a4ba33f2ef880947862eaaeceadb2a51bfebb688 AS grub -# because python is not available -RUN ln -s python3 /usr/bin/python - -ENV GRUB_MODULES="part_gpt fat ext2 iso9660 gzio linux acpi normal cpio crypto disk boot crc64 gpt \ -search_disk_uuid tftp verify xzio xfs video" -ENV GRUB_COMMIT=d3fd939f18446b05d1d5456f23823498a1eb3fb4 - -RUN mkdir /grub-lib && \ - set -e && \ - git clone https://github.com/coreos/grub.git && \ - cd grub && \ - git checkout -b grub-build ${GRUB_COMMIT} && \ - ./autogen.sh && \ - ./configure --libdir=/grub-lib --with-platform=efi CFLAGS="-Os -Wno-unused-value" && \ - make -j "$(getconf _NPROCESSORS_ONLN)" && \ - make install && \ - case $(uname -m) in \ - x86_64) \ - ./grub-mkimage -O x86_64-efi -d /grub-lib/grub/x86_64-efi -o /grub-lib/BOOTX64.EFI -p /EFI/BOOT ${GRUB_MODULES} linuxefi; \ - ;; \ - aarch64) \ - ./grub-mkimage -O arm64-efi -d /grub-lib/grub/arm64-efi -o /grub-lib/BOOTAA64.EFI -p /EFI/BOOT ${GRUB_MODULES}; \ - ;; \ - esac - -FROM linuxkit/alpine:3683c9a66cd4da40bd7d6c7da599b2dcd738b559 AS mirror +FROM linuxkit/alpine:518c2ed0f398c5508969ac5e033607201fb419ed AS mirror RUN mkdir -p /out/etc/apk && cp -r /etc/apk/* /out/etc/apk/ RUN apk add --no-cache --initdb -p /out \ alpine-baselayout \ @@ -57,6 +19,6 @@ RUN mv /out/etc/apk/repositories.upstream /out/etc/apk/repositories FROM scratch WORKDIR / COPY --from=mirror /out/ / -COPY --from=grub-build /grub-lib/BOOT*.EFI /usr/local/share/ +COPY --from=grub /BOOT*.EFI /usr/local/share/ COPY . . ENTRYPOINT [ "/make-efi" ] diff --git a/tools/mkimage-raw-efi/Dockerfile b/tools/mkimage-raw-efi/Dockerfile index 0530e36e4..656f0c351 100644 --- a/tools/mkimage-raw-efi/Dockerfile +++ b/tools/mkimage-raw-efi/Dockerfile @@ -1,43 +1,6 @@ -FROM linuxkit/alpine:3683c9a66cd4da40bd7d6c7da599b2dcd738b559 AS grub-build -RUN apk add \ - autoconf \ - automake \ - bison \ - gcc \ - gettext \ - git \ - flex \ - libc-dev \ - libtool \ - linux-headers \ - make \ - python3 -# because python is not available -RUN ln -s python3 /usr/bin/python +FROM linuxkit/grub:a4ba33f2ef880947862eaaeceadb2a51bfebb688 AS grub -ENV GRUB_MODULES="part_gpt fat ext2 iso9660 gzio linux acpi normal cpio crypto disk boot crc64 gpt \ -search_disk_uuid tftp verify xzio xfs video" -ENV GRUB_COMMIT=d3fd939f18446b05d1d5456f23823498a1eb3fb4 - -RUN mkdir /grub-lib && \ - set -e && \ - git clone https://github.com/coreos/grub.git && \ - cd grub && \ - git checkout -b grub-build ${GRUB_COMMIT} && \ - ./autogen.sh && \ - ./configure --libdir=/grub-lib --with-platform=efi CFLAGS="-Os -Wno-unused-value" && \ - make -j "$(getconf _NPROCESSORS_ONLN)" && \ - make install && \ - case $(uname -m) in \ - x86_64) \ - ./grub-mkimage -O x86_64-efi -d /grub-lib/grub/x86_64-efi -o /grub-lib/BOOTX64.EFI -p /EFI/BOOT ${GRUB_MODULES} linuxefi; \ - ;; \ - aarch64) \ - ./grub-mkimage -O arm64-efi -d /grub-lib/grub/arm64-efi -o /grub-lib/BOOTAA64.EFI -p /EFI/BOOT ${GRUB_MODULES}; \ - ;; \ - esac - -FROM linuxkit/alpine:3683c9a66cd4da40bd7d6c7da599b2dcd738b559 AS mirror +FROM linuxkit/alpine:518c2ed0f398c5508969ac5e033607201fb419ed AS mirror RUN mkdir -p /out/etc/apk && cp -r /etc/apk/* /out/etc/apk/ RUN apk add --no-cache --initdb -p /out \ alpine-baselayout \ @@ -55,6 +18,6 @@ RUN mv /out/etc/apk/repositories.upstream /out/etc/apk/repositories FROM scratch WORKDIR / COPY --from=mirror /out/ / -COPY --from=grub-build /grub-lib/BOOT*.EFI /usr/local/share/ +COPY --from=grub /BOOT*.EFI /usr/local/share/ COPY . . ENTRYPOINT [ "/make-efi" ]