box

command module
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

README

Box: A Next-Generation Builder for Docker Images

Build Status 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.

  • Unique general features:

    • mruby syntax
    • filtering of keywords to secure builds
    • REPL (shell) for interactive building (see video below)
    • Multiple builds at once: build whole projects worth of images
  • In the build plan itself:

    • Tagging
    • Flattening
    • Debug mode (drop to a shell in the middle of a plan run and inspect your container)
    • Ruby block methods for user (with_user) and workdir (inside) allow you to scope copy and run operations for a more obvious build plan.
  • Download Releases

  • Extended Documentation for Syntax and Usage

  • Homebrew Tap

Using the Homebrew Tap

brew tap erikh/box && brew install erikh/box/box

Example

This will fetch the golang image, update APT, and then install the packages set in the packages variable. It then creates a user and copies the dir to its homedir. If an environment value is provided, it will be used. Then it will tag the whole image as mypackages.

Save it to plan.rb and run it with box plan.rb. Box only copies what it needs to; your whole directory won't be uploaded to docker.

from "golang"

packages = "build-essential g++ git wget curl ruby bison flex"

run "apt-get update"
run "apt-get install -y #{packages}"

run %q[useradd -m -d /home/erikh -s /bin/bash erikh]

inside "/home/erikh" do
  copy((getenv("MYDIR") || "."), ".")
end

tag "mypackages"

Video

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

Available in v0.3 and up

Box REPL

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 https://github.com/erikh/box && cd $GOPATH/src/github.com/erikh/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 bootstrap
  • To run the tests without a dev environment configured:
    • make bootstrap-test
  • If you have a dev environment:
    • make test
      • note that if you are building both on the hosts and in the test containers, IGNORE_LIBMRUBY=1 may be of interest to you if you get linking errors or GC panics.
  • To do a release build:
    • make release

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL