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.
-
📦 Portable Rootfs: Easily create and manage multiple portable Alpine Linux environments.
-
⚡ Minimal Setup: Fast and lightweight initialization of the Alpine ecosystem.
-
🧪 Safe Sandboxing: Secure environment for testing applications or restricted systems.
-
📁 Multi-Directory Support: Manage different rootfs instances independently.
-
💪 Static Compilation: Optimized for building static binaries using
musland Alpine's toolchain. -
🛠️ Build System: Direct integration with APKBUILDs to simplify the packaging process.
-
🌌 OverlayFS Support: Layer changes over your rootfs to keep the base system clean.
-
⏳ Ephemeral Sessions: Automatically discard modifications after execution using the
-eflag. -
🔒 Enhanced Isolation: Use
-sfor secure, minimal mounting and maximum sandboxing. -
💼 Fully Portable: Run anywhere without complex installation or host dependencies.
-
🔑 Rootless Execution: Full functionality without requiring real root privileges.
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 created to be free software.
Therefore, they can be distributed and/or modified within the terms of the MIT License.
See the MIT License file for details.
- 📧 Email: m10ferrari1200@gmail.com
- 📧 Email: contatolinuxdicaspro@gmail.com
- 🛠️ Issues: Report a bug
Developed with precision in Rust. 🦀
