From 036025b9b9719ee64776e293d8c267ad739c6fe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A6titia=20Delvaux?= Date: Thu, 23 Nov 2023 18:14:33 +0100 Subject: [PATCH 1/4] Preliminary support for foreign architecture images. --- etc/bases | 5 +++++ libexec/commands/boot | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/etc/bases b/etc/bases index a2b18c9..e5cbb9d 100644 --- a/etc/bases +++ b/etc/bases @@ -41,3 +41,8 @@ d12u ghcr.io/perfsonar/unibuild/d12:latest u18u ghcr.io/perfsonar/unibuild/u18:latest u20u ghcr.io/perfsonar/unibuild/u20:latest u22u ghcr.io/perfsonar/unibuild/u22:latest +# Some foreign architecture images, they need to have full sha256 identifier +d11uarm64 ghcr.io/perfsonar/unibuild/d11:latest@sha256:7b2fcc86008c8c1d2b89703872f2756bcd2f651726256f2777afb88418689f3a +d11uarmhf ghcr.io/perfsonar/unibuild/d11:latest@sha256:d8cbb03c5bd8f88a01abd032725fa3c25e5593ddd7d1664e3f63e44021e5f0d7 +d11uppc64 ghcr.io/perfsonar/unibuild/d11:latest@sha256:c712efe4b949cc1f5952a54231cb9ed3bbced94daf82cac6ea49a10b8021cfb0 + diff --git a/libexec/commands/boot b/libexec/commands/boot index 3acc771..e41e702 100755 --- a/libexec/commands/boot +++ b/libexec/commands/boot @@ -103,6 +103,12 @@ case $(uname -s) in ;; esac +# Get image platform architecture +PLATFORM=$(do_docker $DOCKER image inspect \ + "${IMAGE_FULL}" \ + | awk -F \" '/Architecture/ {print $4}' \ +) + do_docker $DOCKER run \ --hostname "${NAME}" \ --name "${CONTAINER_NAME}" \ @@ -114,10 +120,13 @@ do_docker $DOCKER run \ ${VOLUME_CGROUP} \ --volume "${USER_HOME}:${USER_HOME}" \ --security-opt label:disable \ - "${IMAGE_FULL}:latest" \ + --platform "linux/${PLATFORM}" \ + "${IMAGE_FULL}" \ bash /ddb-entrypoint --user-ent "${USER_ENT}" if ${LOGIN_AFTER} then + # Wait a bit for the container to boot properly + sleep 2 exec "${WHEREAMI}/login" "${NAME}" fi From 91575a79635e5d88507400ab1f403bdb7d2e413e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A6titia=20Delvaux?= Date: Wed, 17 Apr 2024 01:30:36 +0200 Subject: [PATCH 2/4] Building images with buildx to support multiarch. Updating Unibuild images in the bases, need to use full sha256 for multiarch. --- etc/bases | 9 ++++++--- libexec/commands/build | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/etc/bases b/etc/bases index e5cbb9d..28faebd 100644 --- a/etc/bases +++ b/etc/bases @@ -42,7 +42,10 @@ u18u ghcr.io/perfsonar/unibuild/u18:latest u20u ghcr.io/perfsonar/unibuild/u20:latest u22u ghcr.io/perfsonar/unibuild/u22:latest # Some foreign architecture images, they need to have full sha256 identifier -d11uarm64 ghcr.io/perfsonar/unibuild/d11:latest@sha256:7b2fcc86008c8c1d2b89703872f2756bcd2f651726256f2777afb88418689f3a -d11uarmhf ghcr.io/perfsonar/unibuild/d11:latest@sha256:d8cbb03c5bd8f88a01abd032725fa3c25e5593ddd7d1664e3f63e44021e5f0d7 -d11uppc64 ghcr.io/perfsonar/unibuild/d11:latest@sha256:c712efe4b949cc1f5952a54231cb9ed3bbced94daf82cac6ea49a10b8021cfb0 +u20uarm64 ghcr.io/perfsonar/unibuild/u20:latest@sha256:133c971b61856ae36d98573c583e8bc3f2ab6f7d4cd5e9d9d40582e5b8d10bed +u20uarmhf ghcr.io/perfsonar/unibuild/u20:latest@sha256:8a50900de792a0ed9f1f56c33f66fcbd654daedd09b4cbd6b7462069e8854ccb +u20uppc64 ghcr.io/perfsonar/unibuild/u20:latest@sha256:3fc81962025cda5b1096cc422bc5d08005d1fc276e6a6cecd873cfdb4f93a376 +d11uarm64 ghcr.io/perfsonar/unibuild/d11:latest@sha256:cfec0dfef4b1f2e661907889124a2209578f4907353318044ae6867668aad68e +d11uarmhf ghcr.io/perfsonar/unibuild/d11:latest@sha256:659d5d9b66c46e785ae6485f8096965d1b20322dccc4612ddaa30ee14d35541c +d11uppc64 ghcr.io/perfsonar/unibuild/d11:latest@sha256:7011afa3ccc18a9c061fd5b25cb74010a35288d3372097e07acea9407a22a610 diff --git a/libexec/commands/build b/libexec/commands/build index 8e522ed..ceea527 100755 --- a/libexec/commands/build +++ b/libexec/commands/build @@ -83,4 +83,4 @@ RUN echo "${CONTAINER_NAME}" > "${CONTAINER_NAME}" EOF cd "${TMPBASE}" -$DOCKER build --pull -t "${CONTAINER_NAME}" -f "${DOCKERFILE}" . +$DOCKER buildx build --pull -t "${CONTAINER_NAME}" -f "${DOCKERFILE}" . From 7559bf395bbc797a86e562450dbd33eff2bca2bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A6titia=20Delvaux?= Date: Thu, 5 Jun 2025 15:32:37 +0200 Subject: [PATCH 3/4] Explicitly specify CPU platform to use when building image. Adding a few Debian and Ubuntu ARM64 and PPC64 images. --- etc/bases | 8 ++++++++ libexec/commands/boot | 5 +---- libexec/commands/build | 4 +++- libexec/common | 7 +++++++ 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/etc/bases b/etc/bases index 8fd2ac5..88e700c 100644 --- a/etc/bases +++ b/etc/bases @@ -41,8 +41,16 @@ u24u ghcr.io/perfsonar/unibuild/u24:latest # ARM64 images # These need to be updated manually as the sha256 hash will change with every new Unibuild release + +arm64d11 arm64v8/debian:11 +arm64d12 arm64v8/debian:12 +arm64u20 arm64v8/ubuntu:20.04 +arm64u22 arm64v8/ubuntu:22.04 +arm64u24 arm64v8/ubuntu:24.04 d11uarm64 ghcr.io/perfsonar/unibuild/d11:latest@sha256:066e09023127a5970e79d021f82a4a4e8d22a6f06f546256f7645bda4f5fade2 d12uarm64 ghcr.io/perfsonar/unibuild/d12:latest@sha256:dd69896d0f1a97cdcf1a6571b8a01100e86c859206f3e0ea55d67dfd3dbbcc46 u20uarm64 ghcr.io/perfsonar/unibuild/u20:latest@sha256:8af119adb3c574b451e410bbed1b6f8e5c36b2e22fb679ec4c7a26f5da18ed76 u22uarm64 ghcr.io/perfsonar/unibuild/u22:latest@sha256:77f035a0d20b968c13454e8e3666fd1f496e580b23ebd8bf6dd6d8283a1c359a u24uarm64 ghcr.io/perfsonar/unibuild/u24:latest@sha256:3349af45196d52f93100434b0e8e7f28c221fe2609d5b29fb76d95ed7eadb4c2 +u20uppc64 ghcr.io/perfsonar/unibuild/u20:latest@sha256:aa3a8b90143e0736d4ada89941e8dff6f28e4d20e1f498d93ce9c1e7e21e20f3 +d11uppc64 ghcr.io/perfsonar/unibuild/u20:latest@sha256:e230b045a8ebbc77d1c953f4fea8e2898fafd536f58c30b2445afe65f8793e5c diff --git a/libexec/commands/boot b/libexec/commands/boot index cc249a2..0227794 100755 --- a/libexec/commands/boot +++ b/libexec/commands/boot @@ -114,10 +114,7 @@ case $(uname -s) in esac # Get image platform architecture -PLATFORM=$(do_docker $DOCKER image inspect \ - "${IMAGE_FULL}" \ - | awk -F \" '/Architecture/ {print $4}' \ -) +PLATFORM=$(get_platform "${IMAGE_FULL}") do_docker $DOCKER run \ --hostname "${NAME}" \ diff --git a/libexec/commands/build b/libexec/commands/build index 35eb29b..b6d70e0 100755 --- a/libexec/commands/build +++ b/libexec/commands/build @@ -62,6 +62,8 @@ do done ) + $DOCKER pull "$BASE_IMAGE" + CONTAINER_PLATFORM=$(get_platform "$BASE_IMAGE") CONTAINER_NAME="${DDB_CONTAINER_PREFIX}${NAME}" cp -r "${DDB}/prep" "${TMPBASE}" @@ -84,6 +86,6 @@ RUN echo "${CONTAINER_NAME}" > "${CONTAINER_NAME}" EOF cd "${TMPBASE}" - $DOCKER buildx build --pull -t "${CONTAINER_NAME}" -f "${DOCKERFILE}" . + $DOCKER buildx build --platform "linux/${CONTAINER_PLATFORM}" --pull -t "${CONTAINER_NAME}" -f "${DOCKERFILE}" . done diff --git a/libexec/common b/libexec/common index 6d56a8f..0390bbc 100644 --- a/libexec/common +++ b/libexec/common @@ -55,6 +55,13 @@ else DOCKER='sudo docker' fi +# Get Docker platform from image +get_platform() +{ + PLATFORM=$($DOCKER image inspect "$1" \ + | awk -F \" '/Architecture/ {print $4}') + echo $PLATFORM +} # Strip comments and blanks out of key/value file $1 and find the # value out of columns 2+. From c737171cb4602f10ba19b012942ba12b5436eb01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A6titia=20Delvaux?= Date: Mon, 14 Jul 2025 18:51:04 +0200 Subject: [PATCH 4/4] Remove sleep before login. --- libexec/commands/boot | 2 -- 1 file changed, 2 deletions(-) diff --git a/libexec/commands/boot b/libexec/commands/boot index 0227794..c6a6d8f 100755 --- a/libexec/commands/boot +++ b/libexec/commands/boot @@ -131,8 +131,6 @@ do_docker $DOCKER run \ if ${LOGIN_AFTER} then - # Wait a bit for the container to boot properly - sleep 2 echo "Logging into ${NAME}" exec "${WHEREAMI}/login" "${NAME}" fi