alpinelinux / alpine-chroot-install

Install Alpine Linux in chroot with a breeze. Build ARM on Travis CI or any other x86_64 CI.
MIT License
294 stars 59 forks source link
alpine-linux chroot ci travis-ci

= Install Alpine Linux in chroot :script-name: alpine-chroot-install :script-sha1: ccbf65f85cdc351851f8ad025bb3e65bae4d5b06 :gh-name: alpinelinux/{script-name} :version: 0.14.0

ifdef::env-github[] image:https://github.com/{gh-name}/workflows/CI/badge.svg["Build Status", link="https://github.com/{gh-name}/actions"] endif::env-github[]

This alpine-chroot-install script simplifies installation of https://alpinelinux.org/[Alpine Linux] for testing purposes on any x86_64 Linux system using https://man7.org/linux/man-pages/man1/chroot.1.html[chroot(1)]. 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 Ubuntu-based CI services (e.g. https://travis-ci.org/[Travis CI] and similar) and possibly emulate other architectures (e.g. ARM) on x86_64-only CI service.

Installation of Alpine Linux is a matter of a few seconds… 5 seconds to be more specific. It takes just ~5 seconds to prepare a chroot, install fresh Alpine including gcc build environment and execute first command! And it doesn’t use any prebuilt rootfs archive or image, and no Docker, of course. All you need to install Alpine Linux is just https://github.com/alpinelinux/apk-tools[apk-tools] -- Alpine’s package manager -- which is automatically downloaded by this script.

Note: If you use GitHub Actions, you’re better off using https://github.com/jirutka/setup-alpine[jirutka/setup-alpine] instead of this script.

== Requirements

Note that Alpine binaries needs up-to-date version of QEMU. If you encounter error qemu: Unsupported syscall, it means that your QEMU version is too old. If you can’t upgrade QEMU (package qemu-user-static on Debian/Ubuntu), try an older Alpine Linux branch (option -b, e.g. -b v3.11).

== Usage

Read documentation in link:{script-name}[{script-name}]. See link:.github/workflows/ci.yml[] for GitHub Actions example.

You can copy link:{script-name}[{script-name}] into your repository or download it on demand, e.g.:

[source, sh, subs="verbatim, attributes"] wget https://raw.githubusercontent.com/{gh-name}/v{version}/{script-name} \ && echo '{script-sha1} {script-name}' | sha1sum -c \ || exit 1

== License

This project is licensed under http://opensource.org/licenses/MIT/[MIT License]. For the full text of the license, see the link:LICENSE[LICENSE] file.