ALPack is a tool developed in Rust designed to create and manage multiple Alpine Linux rootfs environments in a practical and reproducible manner.
It leverages tools such as proot or bubblewrap (bwrap) for environment isolation.
Specifically engineered to be distributed as a fully static binary, ALPack operates
without dynamic dependencies on the host system. This makes it ideal for CI/CD pipelines,
developer workstations, and isolated environments.
While its primary purpose is to facilitate static binary compilation by generating a complete rootfs ready for build workflows and package development, ALPack also supports parameters for configuring minimal environments. This flexibility extends the tool's utility to a wide range of use cases beyond its core build focus.
-
📦 Easily create and manage portable Alpine rootfs.
-
⚡ Fast and minimal Alpine Linux environment setup;
-
🧪 Safe sandboxing for testing or restricted systems;
-
📁 Support for multiple rootfs directories;
-
💪 Ideal for compiling static binaries using musl and Alpine's minimal toolchain.
-
🛠️ Work directly with APKBUILDs, simplifying the packaging process.
-
💼 Run anywhere without complex installation, thanks to its fully portable design.
-
🔒 Runs without real root;
Lightweight, fast, and productivity-focused, ALPack bridges the gap between Alpine Linux flexibility and secure isolated environments.
ALPack <parâmetro> [opções] [--] [ARGS...]Below is a practical workflow designed to be straightforward and reproducible.
Start by setting up a default environment. Use --edge if you intend to work with
APKBUILDs (highly recommended for Alpine-based builds).
$ ALPack setup --edge Commands can be executed in multiple ways. Optionally, use -- to distinguish ALPack
parameters from the guest commands. The -c parameter is also optional and helpful
in specific shell contexts.
$ ALPack run -- cat /etc/os-release$ ALPack run -c "cat /etc/os-release"You can bind-mount your project directory from the host into the rootfs using
--bind-args as shown below:
$ ALPack run --b "--bind /home/user/project:/src" -c "cd /src && ./build.sh"This is particularly useful when your project is located outside the standard home directory.
Here are common examples for C/C++ static builds:
# Force static linking for dependencies and the binary
PKG_CONFIG="pkg-config --static" \
CFLAGS="-static" \
LDFLAGS="-static" \
./configure --disable-shared --enable-static
# -all-static is optional but sometimes required for complex toolchains
make LDFLAGS="-all-static"After compilation, verify if the binary is truly static:
$ ldd static-binary
## not a dynamic executable
## statically linked
$ file static-binary
## ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked,...
## ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), static-pie linked,...You can install AlpineBox manually:
$ wget https://github.com/LinuxDicasPro/ALPack/releases/download/Continuous/ALPack
$ chmod +x ./ALPack
$ sudo mv ./ALPack /usr/bin/ALPackCompiling static binaries offers a significant advantage when you need to distribute
an executable that does not depend on the host's libc or other dynamic libraries.
ALPack streamlines this process because:
-
📌 It provides a ready-to-use and predictable Alpine rootfs for compilation, or a minimal environment where you maintain full control over the build toolchain;
-
📌 It isolates the build from the host system, ensuring that compilation is performed without cluttering the host or relying on local toolchains;
-
📌 ALPack itself is distributed as a static binary, simplifying the portability of the tool across any environment without the need to install multiple dependencies;
-
📌 Alpine Linux includes the necessary static libraries required for
C/C++to compile fully static binaries.
This repository has scripts that were created to be free software. Therefore, they can be distributed and/or modified within the terms of the MIT License.
See the LICENSE file for details.
- 📧 Email: m10ferrari1200@gmail.com
- 📧 Email: contatolinuxdicaspro@gmail.com
- 🛠️ Issues: Report a bug
Developed with precision in Rust. 🦀
