All Projects → box-builder → Box

box-builder / Box

Licence: other
A mruby-based Builder for Docker Images

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Box

Kubler
A generic, extendable build orchestrator.
Stars: ✭ 126 (-46.61%)
Mutual labels:  builder, containers, docker-image
Umoci
umoci modifies Open Container images
Stars: ✭ 349 (+47.88%)
Mutual labels:  containers, docker-image, oci
Buildkit
concurrent, cache-efficient, and Dockerfile-agnostic builder toolkit
Stars: ✭ 4,537 (+1822.46%)
Mutual labels:  builder, containers, oci
Jib
🏗 Build container images for your Java applications.
Stars: ✭ 11,370 (+4717.8%)
Mutual labels:  containers, oci
Ignite
Ignite a Firecracker microVM
Stars: ✭ 1,954 (+727.97%)
Mutual labels:  containers, oci
Bitnami Docker Rabbitmq
Bitnami Docker Image for RabbitMQ
Stars: ✭ 120 (-49.15%)
Mutual labels:  containers, docker-image
Minideb
A small image based on Debian designed for use in containers
Stars: ✭ 1,561 (+561.44%)
Mutual labels:  containers, docker-image
Bitnami Docker Magento
Bitnami Docker Image for Magento
Stars: ✭ 159 (-32.63%)
Mutual labels:  containers, docker-image
Gvisor
Application Kernel for Containers
Stars: ✭ 12,012 (+4989.83%)
Mutual labels:  containers, oci
Image Tools
OCI Image Tooling
Stars: ✭ 167 (-29.24%)
Mutual labels:  containers, oci
Runtime
Kata Containers version 1.x runtime (for version 2.x see https://github.com/kata-containers/kata-containers).
Stars: ✭ 2,103 (+791.1%)
Mutual labels:  containers, oci
Bitnami Docker Mysql
Bitnami MySQL Docker Image
Stars: ✭ 116 (-50.85%)
Mutual labels:  containers, docker-image
Bitnami Docker Node
Bitnami Node.js Docker Image
Stars: ✭ 111 (-52.97%)
Mutual labels:  containers, docker-image
Selinux
common selinux implementation
Stars: ✭ 107 (-54.66%)
Mutual labels:  containers, oci
Runtime Spec
OCI Runtime Specification
Stars: ✭ 2,316 (+881.36%)
Mutual labels:  containers, oci
Bitnami Docker Moodle
Bitnami Docker Image for Moodle
Stars: ✭ 188 (-20.34%)
Mutual labels:  containers, docker-image
Orca Build
Build OCI images from Dockerfiles.
Stars: ✭ 159 (-32.63%)
Mutual labels:  containers, oci
Syft
CLI tool and library for generating a Software Bill of Materials from container images and filesystems
Stars: ✭ 196 (-16.95%)
Mutual labels:  containers, oci
Go Digest
Common digest package used across the container ecosystem
Stars: ✭ 99 (-58.05%)
Mutual labels:  containers, oci
Image Spec
OCI Image Format
Stars: ✭ 1,851 (+684.32%)
Mutual labels:  containers, oci

Box: A Next-Generation Builder for Docker Images

Build Status Join the chat at https://gitter.im/box-builder/Lobby Go Report Card

Box is a builder for docker that gives you the power of mruby, a limited, embeddable ruby. It allows for notions of conditionals, loops, and data structures for use within your builder plan. If you've written a Dockerfile before, writing a box build plan is easy.

Box Build Plans are Programs

Exploit this! Use functions! Set variables and constants!

run this plan with:

GOLANG_VERSION=1.7.5 box <plan file>
from "ubuntu"

# this function will create a new layer running the command inside the
# function, installing the required package.
def install_package(pkg)
  run "apt-get install '#{pkg}' -y"
end

run "apt-get update"
install_package "curl" # `run "apt-get install curl -y"`

# get the local environment's setting for GOLANG_VERSION, and set it here:
go_version = getenv("GOLANG_VERSION")
run %Q[curl -sSL \
    https://storage.googleapis.com/golang/go#{go_version}.linux-amd64.tar.gz \
    | tar -xvz -C /usr/local]

Powered by mruby

Box uses the mruby programming language. It does this to get a solid language syntax, functions, variables and more. However, it is not a fully featured Ruby such as MRI and contains almost zero standard library functionality, allowing for only the basic types, and no I/O operations outside of the box DSL are permitted.

You can however:

  • Define classes, functions, variables and constants
  • Access the environment through the getenv box function (which is also omittable if you don't want people to use it)
  • Retrieve the contents of container files with read
  • import libraries (also written in mruby) to re-use common build plan components.

Tagging and Image Editing

You can tag images mid-plan to create multiple images, each subsets (or supersets, depending on how you look at it) of each other.

Additionally, you can use functions like after, skip, and flatten to manipulate images in ways you may not have considered:

from :ubuntu
skip do
  run "apt-get update"
  run "apt-get install curl -y"
  run "curl -sSL -O https://github.com/box-builder/box/releases/download/v0.4.2/box_0.4.2_amd64.deb"
  tag :downloaded
end

run "dpkg -i box*.deb"
after do
  flatten
  tag :installed
end

And more!

All the standard docker build commands such as user, env, and a few new ones:

  • with_user and inside temporarily scope commands to a specific user or working directory respectively, allowing you to avoid nasty patterns like cd foo && thing.
  • debug drop-in statement: drops you to a container in the middle of a build where you place the call.

REPL (Shell)

REPL is short for "read eval print loop" and is just a fancy way of saying this thing has readline support and a shell history. Check the thing out by invoking box repl or box shell.

Here's a video of the shell in action (click for more):

Box REPL

Install

Using the Homebrew Tap

brew tap box-builder/box && brew install box-builder/box/box

Advanced Use

The documentation is the best resource for learning the different verbs and functions. However, check out our own build plan for box for an example of how to use different predicates, functions, and verbs to get everything you need out of it.

Development Instructions

  • Requires: compiler, bison, flex, and libgpgme, libdevmapper, btrfs headers.
  • go get -d github.com/box-builder/box && cd $GOPATH/src/github.com/box-builder/box
  • To build on the host (create a dev environment):
    • make
  • To build a docker image for your dev environment (needed for test and release builds):
    • make build
  • If you have a dev environment:
    • make test
  • To do a release build:
    • VERSION=<version> make release
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].