{"id":13415858,"url":"https://github.com/box-builder/box","last_synced_at":"2025-03-14T23:31:13.196Z","repository":{"id":65961726,"uuid":"70178718","full_name":"box-builder/box","owner":"box-builder","description":"A mruby-based Builder for Docker Images","archived":true,"fork":false,"pushed_at":"2018-07-05T17:59:05.000Z","size":4488,"stargazers_count":238,"open_issues_count":24,"forks_count":19,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-07-31T21:54:43.748Z","etag":null,"topics":["builder","containers","docker","docker-image","dockerfile","image","mruby","oci","repl"],"latest_commit_sha":null,"homepage":"https://box-builder.github.io/box/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/box-builder.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-06T17:53:51.000Z","updated_at":"2024-07-04T22:27:53.000Z","dependencies_parsed_at":"2023-02-18T19:50:14.950Z","dependency_job_id":null,"html_url":"https://github.com/box-builder/box","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/box-builder%2Fbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/box-builder%2Fbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/box-builder%2Fbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/box-builder%2Fbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/box-builder","download_url":"https://codeload.github.com/box-builder/box/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243663459,"owners_count":20327299,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["builder","containers","docker","docker-image","dockerfile","image","mruby","oci","repl"],"created_at":"2024-07-30T21:00:52.589Z","updated_at":"2025-03-14T23:31:10.453Z","avatar_url":"https://github.com/box-builder.png","language":"Go","readme":"# Box: A Next-Generation Builder for Docker Images \n\n[![Build Status](http://jenkins.hollensbe.org:8080/job/box-master/badge/icon)](http://jenkins.hollensbe.org:8080/job/box-master/)\n[![Join the chat at https://gitter.im/box-builder/Lobby](https://badges.gitter.im/box-builder/Lobby.svg)](https://gitter.im/box-builder/Lobby?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n[![Go Report Card](https://goreportcard.com/badge/github.com/box-builder/box)](https://goreportcard.com/report/github.com/box-builder/box)\n\nBox is a builder for docker that gives you the power of mruby, a limited,\nembeddable ruby. It allows for notions of conditionals, loops, and data\nstructures for use within your builder plan. If you've written a Dockerfile\nbefore, writing a box build plan is easy.\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/box-builder/box/master/docs-theme/img/box-logo.png\"\u003e\u003c/img\u003e\u003c/p\u003e\n\n## Box Build Plans are Programs\n\nExploit this! Use functions! Set variables and constants!\n\nrun this plan with:\n\n```shell\nGOLANG_VERSION=1.7.5 box \u003cplan file\u003e\n```\n\n```ruby\nfrom \"ubuntu\"\n\n# this function will create a new layer running the command inside the\n# function, installing the required package.\ndef install_package(pkg)\n  run \"apt-get install '#{pkg}' -y\"\nend\n\nrun \"apt-get update\"\ninstall_package \"curl\" # `run \"apt-get install curl -y\"`\n\n# get the local environment's setting for GOLANG_VERSION, and set it here:\ngo_version = getenv(\"GOLANG_VERSION\")\nrun %Q[curl -sSL \\\n    https://storage.googleapis.com/golang/go#{go_version}.linux-amd64.tar.gz \\\n    | tar -xvz -C /usr/local]\n```\n\n### Powered by mruby\n\nBox uses the [mruby programming language](https://mruby.org/). It does\nthis to get a solid language syntax, functions, variables and more.\nHowever, it is not a fully featured Ruby such as MRI and contains almost\nzero standard library functionality, allowing for only the basic types,\nand no I/O operations outside of the box DSL are permitted.\n\nYou can however:\n\n* Define classes, functions, variables and constants\n* Access the environment through the\n  [getenv](https://box-builder.github.io/box/user-guide/functions/#getenv) box function (which is also\n  [omittable](https://box-builder.github.io/box/user-guide/cli/#-omit-o) if you don't want people to use\n  it)\n* Retrieve the contents of container files with [read](https://box-builder.github.io/box/user-guide/functions/#read)\n* [import](https://box-builder.github.io/box/user-guide/functions/#import) libraries (also written in\n  mruby) to re-use common build plan components.\n\n### Tagging and Image Editing\n\nYou can tag images mid-plan to create multiple images, each subsets (or\nsupersets, depending on how you look at it) of each other.\n\nAdditionally, you can use functions like\n[after](https://box-builder.github.io/box/user-guide/verbs/#after), [skip](https://box-builder.github.io/box/user-guide/functions/#skip),\nand [flatten](https://box-builder.github.io/box/user-guide/verbs/#flatten) to manipulate images in ways\nyou may not have considered:\n\n```ruby\nfrom :ubuntu\nskip do\n  run \"apt-get update\"\n  run \"apt-get install curl -y\"\n  run \"curl -sSL -O https://github.com/box-builder/box/releases/download/v0.4.2/box_0.4.2_amd64.deb\"\n  tag :downloaded\nend\n\nrun \"dpkg -i box*.deb\"\nafter do\n  flatten\n  tag :installed\nend\n```\n\n### And more!\n\nAll the standard docker build commands such as user, env, and a few new ones:\n\n* `with_user` and `inside` temporarily scope commands to a specific user or\n  working directory respectively, allowing you to avoid nasty patterns like\n  `cd foo \u0026\u0026 thing`.\n* `debug` drop-in statement: drops you to a container in the middle of a build\n  where you place the call.\n\n### REPL (Shell)\n\nREPL is short for \"read eval print loop\" and is just a fancy way of saying this\nthing has readline support and a shell history. Check the thing out by invoking\n`box repl` or `box shell`.\n\nHere's a video of the shell in action (click for more):\n\n[![Box REPL](https://asciinema.org/a/c1n0h0g73f10x4cuzjf1i51vg.png)](https://asciinema.org/a/c1n0h0g73f10x4cuzjf1i51vg)\n\n## Install\n\n* Easy install: `curl -sSL box-builder.sh | sudo bash`\n* **[Download Releases](https://github.com/box-builder/box/releases/)**\n* **[Homebrew Tap](https://github.com/box-builder/homebrew-box)**\n\n### Using the Homebrew Tap\n\n```bash\nbrew tap box-builder/box \u0026\u0026 brew install box-builder/box/box\n```\n## Advanced Use\n\nThe [documentation](https://box-builder.github.io/box/) is the best resource for\nlearning the different verbs and functions. However, check out\n[our own build plan for box](https://github.com/box-builder/box/blob/master/build.rb)\nfor an example of how to use different predicates, functions, and verbs to\nget everything you need out of it.\n\n## Development Instructions\n\n* **Requires**: compiler, bison, flex, and libgpgme, libdevmapper, btrfs headers.\n* `go get -d github.com/box-builder/box \u0026\u0026 cd $GOPATH/src/github.com/box-builder/box`\n* To build on the host (create a dev environment):\n  * `make`\n* To build a docker image for your dev environment (needed for test and release builds):\n  * `make build`\n* If you have a dev environment:\n  * `make test`\n* To do a release build:\n  * `VERSION=\u003cversion\u003e make release`\n","funding_links":[],"categories":["Container Operations","Go"],"sub_categories":["Container Composition"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbox-builder%2Fbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbox-builder%2Fbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbox-builder%2Fbox/lists"}