From 77b89adbbfbc21c44a096452c8eb4ac84311ef1c Mon Sep 17 00:00:00 2001 From: Mauro Morales Date: Tue, 7 May 2024 17:01:03 +0200 Subject: [PATCH] refactor debian dockerfile to build arm (#2542) Refactor to be able to build debian arm Signed-off-by: Mauro Morales --- images/Dockerfile.debian | 23 +++++++++++++++++------ images/Dockerfile.kairos-debian | 23 +++++++++++++++++------ 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/images/Dockerfile.debian b/images/Dockerfile.debian index 4459551ce..39d944828 100644 --- a/images/Dockerfile.debian +++ b/images/Dockerfile.debian @@ -117,7 +117,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ ############################################################### #### Common to a Model #### ############################################################### -FROM common AS generic +FROM common AS amd64-generic RUN apt-get update \ && apt-get install -y --no-install-recommends \ grub2 \ @@ -129,24 +129,35 @@ RUN apt-get update \ zfsutils-linux \ && apt-get clean && rm -rf /var/lib/apt/lists/* -FROM common AS rpicommon -RUN sed -i 's/^Components: main.*$/& non-free-firmware/' /etc/apt/sources.list.d/debian.sources +FROM common AS arm64-common RUN apt-get update \ && apt-get install -y --no-install-recommends \ grub-efi-arm64-bin \ grub-efi-arm64-signed \ linux-image-arm64 \ + && apt-get clean && rm -rf /var/lib/apt/lists/* + +FROM arm64-common AS arm64-generic +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + qemu-guest-agent \ + && apt-get clean && rm -rf /var/lib/apt/lists/* + +FROM arm64-common AS rpicommon +RUN sed -i 's/^Components: main.*$/& non-free-firmware/' /etc/apt/sources.list.d/debian.sources +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ raspi-firmware \ && apt-get clean && rm -rf /var/lib/apt/lists/* COPY rpi/config.txt /boot/config.txt -FROM rpicommon AS rpi3 -FROM rpicommon AS rpi4 +FROM rpicommon AS arm64-rpi3 +FROM rpicommon AS arm64-rpi4 ############################################################### #### Post-Process Common to All #### ############################################################### -FROM ${MODEL} AS all +FROM ${TARGETARCH}-${MODEL} AS all RUN systemctl enable systemd-networkd RUN systemctl enable ssh diff --git a/images/Dockerfile.kairos-debian b/images/Dockerfile.kairos-debian index 6789e0549..60c85c1d4 100644 --- a/images/Dockerfile.kairos-debian +++ b/images/Dockerfile.kairos-debian @@ -116,7 +116,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ ############################################################### #### Common to a Model #### ############################################################### -FROM common AS generic +FROM common AS amd64-generic RUN apt-get update \ && apt-get install -y --no-install-recommends \ grub2 \ @@ -128,24 +128,35 @@ RUN apt-get update \ zfsutils-linux \ && apt-get clean && rm -rf /var/lib/apt/lists/* -FROM common AS rpicommon -RUN sed -i 's/^Components: main.*$/& non-free-firmware/' /etc/apt/sources.list.d/debian.sources +FROM common AS arm64-common RUN apt-get update \ && apt-get install -y --no-install-recommends \ grub-efi-arm64-bin \ grub-efi-arm64-signed \ linux-image-arm64 \ + && apt-get clean && rm -rf /var/lib/apt/lists/* + +FROM arm64-common AS arm64-generic +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + qemu-guest-agent \ + && apt-get clean && rm -rf /var/lib/apt/lists/* + +FROM arm64-common AS rpicommon +RUN sed -i 's/^Components: main.*$/& non-free-firmware/' /etc/apt/sources.list.d/debian.sources +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ raspi-firmware \ && apt-get clean && rm -rf /var/lib/apt/lists/* COPY rpi/config.txt /boot/config.txt -FROM rpicommon AS rpi3 -FROM rpicommon AS rpi4 +FROM rpicommon AS arm64-rpi3 +FROM rpicommon AS arm64-rpi4 ############################################################### #### Post-Process Common to All #### ############################################################### -FROM ${MODEL} AS all +FROM ${TARGETARCH}-${MODEL} AS all RUN systemctl enable systemd-networkd RUN systemctl enable ssh