From 0c0d4921d4d7da11cf5d12e8aecfb5fc0a18c347 Mon Sep 17 00:00:00 2001 From: Hongxu Jia Date: Mon, 1 Apr 2024 10:05:26 -0400 Subject: [PATCH 1/2] assemble arm64 image in amd64 container Update doc to install qemu-user-static rather than call apt install in tools/build-container.sh Remove duplicated option -v $(pwd):/usr/src Signed-off-by: Hongxu Jia --- README.container | 8 ++++++-- tools/build-container.sh | 4 ---- tools/run-container.sh | 1 - 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/README.container b/README.container index 4e5e901..b79c108 100644 --- a/README.container +++ b/README.container @@ -3,11 +3,15 @@ To create a dev environment for ruck In order to use ruck in a container you be using docker. The host should be running a Debian based Linux distrobution. -1. Build the dev container from the main directory, run: +1. If assemble arm64 image in amd64 container, install qemu-user-static + + sudo apt install qemu-user-static -y + +2. Build the dev container from the main directory, run: tools/build-container.sh -2. To run the dev container from the main directory, run: +3. To run the dev container from the main directory, run: tools/run-container.sh diff --git a/tools/build-container.sh b/tools/build-container.sh index 034916c..2809fff 100755 --- a/tools/build-container.sh +++ b/tools/build-container.sh @@ -1,7 +1,3 @@ #!/bin/bash -# qemu-binfmt with non-native chroot -sudo apt update -sudo apt install qemu-user-static -y - docker build -t ruck docker diff --git a/tools/run-container.sh b/tools/run-container.sh index b2548a3..47637e8 100755 --- a/tools/run-container.sh +++ b/tools/run-container.sh @@ -8,5 +8,4 @@ docker run \ -v /run:/run \ -v /sys:/sys \ -v /var/tmp:/var/tmp \ - -v $(pwd):/usr/src \ -i -t ruck \ From 8a7cafc534b9fd076052d8b8ed53dbc808a50f5c Mon Sep 17 00:00:00 2001 From: Hongxu Jia Date: Mon, 1 Apr 2024 23:29:04 -0400 Subject: [PATCH 2/2] Dockerfile: convert base container to debian:bookworm After convert base container to debian:bookworm, it caused mmdebstrap was downgraded from 1.4.3 to 1.3.5. The old version does not `stop copying qemu-$arch-static binary into the chroot'[1]. So we need to install qemu-user-static to container otherwise assemble arm64 image in amd64 container failed ... E: setup failed: E: cannot find /usr/bin/qemu-aarch64-static I: main() received signal PIPE: waiting for setup... I: removing tempdir /tmp/mmdebstrap.ICTBGw4f86... E: mmdebstrap failed to run ... [1] https://gitlab.mister-muffin.de/josch/mmdebstrap/commit/21366f76b79dfb4e0c929ac8365eb47e3c47f215 Signed-off-by: Hongxu Jia --- docker/Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index ae1bb6f..2ff7047 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:testing +FROM debian:bookworm # Don't pin the packages versions to exact values # hadolint ignore=DL3008 @@ -33,6 +33,8 @@ RUN apt-get update && \ git && \ rm -rf /var/lib/apt/lists/* +RUN if [ "$(uname -m)" = "x86_64" ]; then apt update && apt install qemu-user-static arch-test -y; fi + COPY files/pip.conf /etc/pip.conf RUN pip install omegaconf