Skip to content

Commit

Permalink
Merge pull request #87 from romainx/feat_qemu_upd
Browse files Browse the repository at this point in the history
Use qemu-user-static image and avoid download qemu step
  • Loading branch information
isuruf authored Dec 21, 2020
2 parents 68a3b57 + c327968 commit 03b1cc0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 42 deletions.
30 changes: 18 additions & 12 deletions build_miniforge.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
#!/usr/bin/env bash

# Build miniforge installers for Linux
# on various architectures (aarch64, x86_64, ppc64le)
# Notes:
# It uses the qemu-user-static [1] emulator to enable
# the use of containers images with different architectures than the host
# [1]: https://github.com/multiarch/qemu-user-static/
# See also: [setup-qemu-action](https://github.com/docker/setup-qemu-action)
set -ex

# Check parameters
ARCH=${ARCH:-aarch64}
DOCKER_ARCH=${DOCKER_ARCH:arm64v8}
DOCKER_ARCH=${DOCKER_ARCH:-arm64v8}
DOCKERIMAGE=${DOCKERIMAGE:-condaforge/linux-anvil-aarch64}
export CONSTRUCT_ROOT=/construct

Expand All @@ -13,18 +19,18 @@ mkdir -p build/
chmod 777 build/

echo "============= Enable QEMU ============="
docker run --rm --privileged multiarch/qemu-user-static:register --reset --credential yes
# Enable qemu in persistent mode
docker run --rm --privileged multiarch/qemu-user-static \
--reset --credential yes --persistent yes

echo "============= Build the installer ============="
docker run --rm -v $(pwd):/construct -e CONSTRUCT_ROOT -e MINIFORGE_VERSION -e MINIFORGE_NAME $DOCKERIMAGE /construct/scripts/build.sh

echo "============= Download QEMU static binaries ============="
bash scripts/get_qemu.sh
docker run --rm -v "$(pwd):/construct" \
-e CONSTRUCT_ROOT -e MINIFORGE_VERSION -e MINIFORGE_NAME \
${DOCKERIMAGE} /construct/scripts/build.sh

echo "============= Test the installer ============="
for TEST_IMAGE_NAME in "ubuntu:20.04" "ubuntu:19.10" "ubuntu:16.04" "ubuntu:18.04" "centos:7" "debian:buster"
do
echo "============= Test installer on $TEST_IMAGE_NAME ============="
docker run --rm -v $(pwd):/construct -e CONSTRUCT_ROOT -v $(pwd)/build/qemu/qemu-${ARCH}-static:/usr/bin/qemu-${ARCH}-static ${DOCKER_ARCH}/$TEST_IMAGE_NAME /construct/scripts/test.sh
for TEST_IMAGE_NAME in "ubuntu:20.04" "ubuntu:19.10" "ubuntu:16.04" "ubuntu:18.04" "centos:7" "debian:buster"; do
echo "============= Test installer on ${TEST_IMAGE_NAME} ============="
docker run --rm -v "$(pwd):/construct" -e CONSTRUCT_ROOT \
"${DOCKER_ARCH}/${TEST_IMAGE_NAME}" /construct/scripts/test.sh
done

30 changes: 0 additions & 30 deletions scripts/get_qemu.sh

This file was deleted.

0 comments on commit 03b1cc0

Please sign in to comment.