DevBox is a portable virtual development environment supporting Everything-as-Code principles.
The DevBox is a portable shell environment and toolkit for software/ops engineers. It builds Docker images packed with common tools so that they can be used via Containers.
This saves us from requiring more from the host machine other than brew install docker kubectl helm
, and Rancher Desktop (to manage image/container resources).
- Bash shell, upgraded and enhanced with completions, colors, functions, aliases, etc.
- Common build dependencies needed by a variety of languages.
- Common global dependencies for Nodejs, Python, and Ruby.
- Java toolset managed with SDKMAN!
- Infrastructure-as-Code tools, e.g.; OpenTofu, Terraform, and Terragrunt.
Forking is encouraged! Everyone has their own unique preferences. For those who take this route, remember to pull from your repo in the instructions below. Then
git checkout -b my_branch
so you can manage upstream changes onmain
without impactingmy_branch
.
-
Clone repo to a user-accessible directory. These instructions use the
HOME
directory, where most users are guaranteed to have access.git clone https://github.com/seantrane/devbox.git "$HOME/devbox"
-
Bootstrap the DevBox. This edits the
~/.profile
and~/.bash_profile
files, adding the DevBox bin directory toPATH
."$HOME/devbox/bin/devbox" bootstrap
-
Restart the terminal or shell environment.
-
This should enable easier access to the DevBox CLI, without typing the full path to the script.
devbox run
-
Run any binary, command, alias, or function (from the DevBox) in the current host directory.
devbox run tree -aC --gitignore
-
Launch the DevBox container, mounting the current host directory to the DevBox
/mnt/pwd
directory.devbox run
-
The DevBox has many built-in aliases, functions, and shortcuts.
la # => ls -lahF --color=always --time-style=long-iso lsd # => ls -AhF --color=always --time-style=long-iso | sed '/[^\/]$/d' lsdl # => ls -lAhF --color=always --time-style=long-iso | sed '/^[-l]/d' .. # => cd .. ... # => cd ../.. .... # => cd ../../..
-
Create shell aliases in the host machine that point to commands in the DevBox. This saves having to install such dependencies on the host machine.
alias aws="devbox run aws" alias gcloud="devbox run gcloud" alias gh="devbox run gh" alias go="devbox run go" alias terraform="devbox run terraform" alias terragrunt="devbox run terragrunt" alias tflint="devbox run tflint" alias tofu="devbox run tofu"
The config
directory is for storing Dockerfiles. All files should follow the Dockerfile.[name]
naming convention, to avoid conflict and enable selection by CLI script. Existing image
names are:
base
– shell enhacement onlyfull
– full-stack toolset (default)iac
– Infrastructure-as-Code tools only
The context
directory is for storing all assets that will be shared with the container image. The image build process will not be able to access anything outside of this path. If the asset must be COPY
or ADD
to the image, it belongs in this directory.
The CLI provides a short, easy-to-type command format to enable quick access and control of any DevBox.
devbox
DevBox is a portable virtual development environment supporting Everything-as-Code principles.
Usage:
devbox [command][-image] (launch Bash session in container)
devbox [command][-image] [bin-command] [arguments] (execute binary command inside container)
devbox [command][-image] [alias/function] [arguments] (execute shell alias/function inside container)
devbox [docker-command][-image] [docker-command-options] (docker command proxy)
Options:
-h, --help
Display help message and exit.
Arguments:
[1] [command][-image] is a dash-separated compound argument with 2 segments.
Only [command] is required. Dash is only required with [image] segment.
The 'Command' argument segment is meant to proxy Docker commands.
- DevBox commands: remove, build, run, rerun, rebuild, upgrade.
- Docker commands also work, with no need for trailing image-argument.
The 'Image' argument segment is optional (default: 'full'), represents
the extension of Dockerfile to use for build, e.g.; Dockerfile.full.
- Image options: base, iac, full
[*] All additional arguments are passed into the container.
Bash prompt is provided when no arguments are passed.
Returns:
None
Examples of (devbox [command][-image]):
devbox remove = devbox remove-full
devbox build = devbox build-full
devbox rebuild = devbox rebuild-full
devbox run = devbox run-full
devbox rerun = devbox rerun-full
devbox inspect = devbox inspect:full
devbox [docker-command] = devbox [docker-command]-full
devbox remove-base
devbox build-base
devbox rebuild-base
devbox run-base
devbox rerun-base
devbox inspect-base
Examples of (devbox [command][-image] [bin-command] [arguments]):
devbox run tree -aC --gitignore
devbox run apt search vim
Examples of (devbox [command][-image] [alias/function] [arguments]):
devbox run la /
devbox run ip opensource.org
Examples of (devbox [docker-command][-image] [docker-command-options]):
devbox inspect = devbox inspect-full
devbox inspect-base
Submit an issue, in which you should provide as much detail as necessary for your issue.
Contributions are always appreciated. Read CONTRIBUTING.md documentation to learn more.
Release details are documented in the CHANGELOG.md file, and on the GitHub Releases page.
Copyright (c) 2020 Sean Trane Sciarrone