archyworldys

Devbox, a toolkit for developers, it provides simple and predictable shells and containers, without the need to write a Dockerfile

DevBox is a collection of small tools for developers (and designers) containing generators, converters, encoders and other useful widgets. It is also a command-line tool that makes it easy to create isolated shells and containers. The user starts by defining the list of packages required by their development environment, and Devbox uses this definition to create an isolated environment just for the application.

DevBox allows you to declare the list of tools required by a project via a devbox.json file and run devbox shell. Each person working on the project gets a shell environment with exactly the same version of these tools. The development environments created are isolated from everything else on your laptop. It can create isolated environments right on your laptop, without an extra layer of virtualization slowing down your file system or every command. When you are ready to stream, it will turn it into an equivalent container; but not before.

In case the user is working on multiple projects, all of which need different versions of the same binary, instead of trying to install conflicting versions of the same binary on the laptop, it is possible to create an isolated environment for each project and use the version of his choice for each of them.

Devbox analyzes the source code and instantly transforms it into an OCI-compliant image that can be deployed on any cloud. According to its maintainers, the image is optimized for speed, size, security, and caching… and without the need to write a Dockerfile. And unlike buildpacks, it would do it quickly. Recall that the OCI standard is a standard that allows the exchange of catalog data records to search and choose a product between management systems.

Read also  WhatsApp fans love this trick: Messenger is now making a feature out of it

Applications often need the same set of dependencies when developing on our laptop and when packaging them as a container ready to deploy to the cloud. Devbox development environments are isomorphic: this means that the user can transform them into both a local shell environment or a container ready to be deployed in the cloud.

Installation de Devbox

In addition to installing Devbox itself, nix et docker must also be installed since Devbox depends on it:

  1. Install the Nix package manager.
  2. Install Docker Engine or Docker Desktop. (Docker is only needed if the user is creating containers – shell functionality works without it.)
  3. Install Devbox:

curl -fsSL https://get.jetpack.io/devbox | bash

Fast and deterministic shell

Creation of a development shell with specific tools installed. These tools will only be available when using this Devbox shell, so as not to clutter the machine.

Open a terminal in a new empty folder.

Initialize Devbox:

devbox init

This creates a file devbox.json in the current directory. You must commit it to source control.

Add command line tools from Nix Packages. For example, to add Python 3.10:

devbox add python310

Your file devbox.json keeps track of the packages you’ve added, it should now look like this:

1
2
3
4
5

{
   "paquets" : [
      "python310"
    ]
}

Start a new shell with these tools installed:

shell devbox

It is possible to know that you are in a Devbox shell (and not in a normal terminal) because the shell prompt and directory have changed. In this example, we have installed Python 3.10.

Using Python 3.10

python --version

Your usual tools are also available, including environment variables and configuration settings.

git config --get user.name

To exit the Devbox shell and return to your usual shell:

exit

Image Docker instantane

Devbox makes it easy to package the application in an OCI-compliant container image. Devbox analyzes the code, automatically identifies the toolchain needed for the project and builds it into a Docker image. It is recommended

  • initialize the project with devbox init to build the image;
  • to build the image: devbox build. The resulting image is named devbox;
  • tag the image with a more descriptive name: docker tag devbox my-image:v0.1

Devbox currently detects Go and Python languages.

Source : DevBox

And you?

What is your opinion on the subject?

In view of the multiplicity of development tools, do you find a tool like DevBox necessary?

See as well :

Vite, the tool for web developers, is its version 3. It aims to provide a faster and lighter development experience for modern web projects.

Fresh, a next-gen web framework, built for speed, reliability, and simplicity, it brings some competition to Next.js

Trending