Buildbox is a lightweight Python CLI tool designed to instantly containerize your development projects using Podman. By specifying a configuration file (boxfile), Buildbox automates the creation of a container, installation of dependencies, copying of project files, and execution of build commands, making it easier to manage development environments.
- Automated Containerization: Instantly containerizes your project based on a
boxfileconfiguration. - Podman Integration: Uses Podman to build and run containers.
- Flexible Setup: Supports custom setup scripts, dependency installations, and post-build commands.
- File Handling: Copies necessary files and project data into the container.
- Python 3.x
- Podman
To install Buildbox, clone this repository and ensure that the script has executable permissions:
git clone <repo-url>
cd buildbox
chmod +x buildbox.pyBuildbox is currently built for podman containers and dnf package manager, will be adding support for Docker and apt, etc. in the future
Ensure you have Podman installed and properly configured on your system:
sudo dnf install podmanThe Buildbox CLI provides two main commands:
- setup: Creates a new containerized environment for your project using the provided
boxfileand builds a container image. - build: Runs the build command inside the container.
-
Setup a Buildbox:
./buildbox.py setup <project_directory> --name <buildbox_name> --boxfile <path_to_boxfile>
Example:
./buildbox.py setup ./my_project --name my_buildbox --boxfile ./boxfile
<project_directory>: (Optional) The directory containing your project. Defaults to the current directory (.).--name: (Optional) Custom name for the buildbox container.--boxfile: (Optional) Path to a customboxfile. Defaults to./boxfileif not provided.
-
Build in the Buildbox:
./buildbox.py build <project_directory>
Example:
./buildbox.py build ./my_project
<project_directory>: (Optional) The directory containing your project. Defaults to the current directory (.).
A boxfile is used to define the environment and build instructions. Below is the structure of a boxfile:
# Base image to use for container
BASEIMAGE fedora:latest
# Dependencies to install
DEPENDENCIES
dnf
gcc
make
# Setup commands to run before build
SETUP
dnf update -y
dnf install -y git
# Files to copy from host to container
COPY
./source_code
./scripts/setup.sh
# Build steps
BUILD
./scripts/setup.sh
make all
# Post-build steps (currently unused)
POSTBUILD
echo "Build complete"- Setup: The
setupcommand reads theboxfile, installs the dependencies, copies files into the container, and creates a Podman container image. - Build: The
buildcommand runs the build process inside the container using the instructions in theboxfile.
- Create a
boxfilein your project directory:
BASEIMAGE fedora:latest
DEPENDENCIES
gcc
make
SETUP
dnf install -y gcc make
COPY
./src
BUILD
gcc -o myapp src/main.c- Run the setup command:
./buildbox.py setup ./my_project --name myapp_box --boxfile ./my_project/boxfile- Run the build command:
./buildbox.py build ./my_projectThis will containerize the project, install the required dependencies, and compile the application inside the container.
This project is licensed under the MIT License. See the LICENSE file for more details.
Contributions are welcome! Please open a pull request or submit an issue for any bug reports or feature requests.
Buildbox simplifies the process of containerizing development projects, ensuring consistency across environments and reducing configuration overhead.