Skip to content

Portable rust tool for Alpine containers using proot and bwrap

License

Notifications You must be signed in to change notification settings

LinuxProativo/ALPack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ALPack

ALPack - Alpine Linux SandBox Packager

Manage Alpine Environments and Compile Static Binaries with Ease.

Platform Linux Build Status Rust Version Cargo Build Latest Release Last Commit License

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.

✨ Features

  • 📦 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.

🚀 Usage

ALPack <parâmetro> [opções] [--] [ARGS...]

⚡ Basic Examples

Below is a practical workflow designed to be straightforward and reproducible.

1) Preparing the Rootfs Environment

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 

2) Running Commands Inside the Rootfs

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"

3) Mounting Source Code into the Rootfs

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.

4) Compiling with Static Linking Flags

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,...

📦 Optional Installation

You can install AlpineBox manually:

$ wget https://github.com/LinuxDicasPro/ALPack/releases/download/Continuous/ALPack
$ chmod +x ./ALPack
$ sudo mv ./ALPack /usr/bin/ALPack

🧪 Why Use ALPack for Static Binary Compilation?

Compiling 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.

📄 MIT License

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.

📬 Contact & Support

Developed with precision in Rust. 🦀

About

Portable rust tool for Alpine containers using proot and bwrap

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Contributors 2

  •  
  •