Install Alpine Linux in chroot
alpine-chroot-install script simplifies installation of Alpine Linux in chroot.
Optionally it also utilizes qemu-user and binfmt to emulate different architecture.
The main purpose of this script is to easily create Alpine environment on debian-based CI (e.g. Travis CI) and possibly emulate other architectures (e.g. ARM) on x86_64 CI server.
Installation of Alpine Linux is a matter of seconds. When you run this script on Travis CI, it takes only 32 seconds to initialize VM, install Alpine into chroot including gcc build environment and execute first command! And just 9 seconds more if you run it with armhf emulation.
Linux system with common userland (Busybox or GNU coreutils)
POSIX-sh compatible shell (e.g. Busybox ash, dash, Bash, ZSH)
qemu-user ≥ 2.6 and binfmt, or apt-get (needed only for emulation of different architecture)
Note that QEMU older than 2.6 doesn’t support syscall
getrandom (384 on ARM) in qemu-user which may cause trouble with Alpine v3.5 and newer.
If older version of qemu-user is detected, the script tries to install newer version of
qemu-user-static using apt-get.
If there’s no newer version in the default system’s repository, it installs
qemu-user-static from the Ubuntu Artful’s repository.
You can copy alpine-chroot-install into your repository or download it on demand, e.g.:
wget https://raw.githubusercontent.com/alpinelinux/alpine-chroot-install/v0.10.0/alpine-chroot-install \ && echo 'dcceb34aa63767579f533a7f2e733c4d662b0d1b alpine-chroot-install' | sha1sum -c \ || exit 1