README
¶
Develbox
A tool to create dev containers using Podman and Go. In other words, like JetPack's Devbox but worse.
Why this exists
After reading about JetPack's Devbox on HackerNews, I wanted to use it to prevent supply-chain attacks when installing packages from NPM or PyPi.
The issue was that Nix isn't available on Fedora Silverblue, as it currently doesn't comply with the FHS (Nix directory is located on /nix
, but /
is read-only on Silverblue) and has issues with SELinux. There are other ways to install it, like:
- Matthewpi's guide to manually installing Nix
- Changing to another distro, like NixOS directly
- Yajo's fork (still hasn't been merged into upstream)
- Nix User Chroot (I became aware of this one too late into the project)
- Nix Portable (Just discovered this one too)
I could instead have used developments containers with VSCode now that I think about it.
So instead of choosing all of those good options, I decided to try to make a script that does something similar to Devbox and Toolbox but worse just to learn Golang.
What does that mean?
Mainly, it means that the code quality here probably is not the best. There are a ton of things that should be improved or made more secure.
I would fix them but my current knowledge of coding, containers, and Linux isn't enough to make this a better product.
TL;DR: It's best to not use this in your projects, as it is made for personal use.
Getting Started
If you are okay with all that, you can install this script by doing the following. First, we should visit the prerequisites.
Prerequisites
This project requires you to have installed
You can get them from your package manager usually with as go
and podman
.
Installing
You can get the project using go install
like this.
go install github.com/kadmuffin/develbox@latest
Usage
It's recommended that you add
.develbox/home
to your.gitignore
file.
Creating the container
You can now proceed to create the container with the following command.
develbox create
Configs file will be located at .develbox/config.json
. See configs folder for documentation.
Opening the shell
After that you can enter the container using:
develbox enter
And stop the container with:
develbox stop
You can delete it using develbox trash
too.
Managing packages
To add a package to the container we can run develbox add
, for example, if we wish to add nano
to the container:
develbox add nano
Now, if we want to delete the package, we use the develbox del
command:
develbox del nano
Contributing
If you wish to contribute to this small repo, you are welcome to submit your pull request. Take into account that I'm a total noob at this, so explanations and patience are appreciated!
License
This project is under the Apache 2.0 License.
Acknowledgments
- Billie Thompson - Provided README Template - PurpleBooth
- Jetpack's Devbox - Inspiration - Devbox
- Toolbox - Used as reference for some things (for example, how to load /dev) - Toolbox
- Martin Viereck - Helpful Wiki - x11docker
- And even more projects in CREDITS.
Directories
¶
Path | Synopsis |
---|---|
Package cmd contains the some commands for the program
|
Package cmd contains the some commands for the program |
create
Package create contains the create command
|
Package create contains the create command |
dockerfile
Package dockerfile contains the logic for creating a Dockerfile
|
Package dockerfile contains the logic for creating a Dockerfile |
pkg
Package pkg has the logic for communication with the package manager
|
Package pkg has the logic for communication with the package manager |
state
Package state manages the state of the container
|
Package state manages the state of the container |
version
Package version has the command to print the version of the program
|
Package version has the command to print the version of the program |
pkg
|
|
config
Package config auto detects the version of the config file and returns the Struct in the latest version
|
Package config auto detects the version of the config file and returns the Struct in the latest version |
config/v1config
Package v1config defines the configuration file and provides functions to read and write it
|
Package v1config defines the configuration file and provides functions to read and write it |
container
Package container contains the logic for creating and entering containers.
|
Package container contains the logic for creating and entering containers. |
global
Package global manages the shared folders feature
|
Package global manages the shared folders feature |
pipes
Package pipes creates a FIFO pipe and provides functions to read/write to it.
|
Package pipes creates a FIFO pipe and provides functions to read/write to it. |
pkgm
Package pkgm manages package installations and removals.
|
Package pkgm manages package installations and removals. |
podman
Package podman is a wrapper around os/exec to run podman commands.
|
Package podman is a wrapper around os/exec to run podman commands. |
socket
Package socket is a wrapper around net package to make it convinient to use for UNIX domain sockets.
|
Package socket is a wrapper around net package to make it convinient to use for UNIX domain sockets. |