Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for foreign architecture images #15

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions etc/bases
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,11 @@ 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
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

11 changes: 10 additions & 1 deletion libexec/commands/boot
Original file line number Diff line number Diff line change
Expand Up @@ -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}" \
Expand All @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest that login be modified to spin on docker exec /bin/true being successful for up to, say, 30 seconds, before attempting to run bash. The fixed 2-second interval invites a race condition for other containers that take longer.

sleep 2
exec "${WHEREAMI}/login" "${NAME}"
fi
2 changes: 1 addition & 1 deletion libexec/commands/build
Original file line number Diff line number Diff line change
Expand Up @@ -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}" .
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this use --platform?