Rudimentary devcontainer support for Emacs
This package lets you handle i.e. start, restart devcontainers of your
projects and forwards all your compile commands into the
devcontainer by advising compilation-start. So as long you use
compile to build, test and run (parts of your) software, all will
be executed inside the devcontainer.
Please consider this package experimental as long as there is no release yet. There might be breaking changes like changing function and variable names out of the blue. So please consider checking the git history when updating.
Source code: https://github.com/johannes-mueller/devcontainer.el
Devcontainers become increasingly popular in modern software development. The idea is to put everything the software you are developing needs in order to run into a docker container or a stack of docker containers. Then all your local builds and testing is performed inside that container. So your development basically takes place inside the docker container – hence the name “devcontainer”.
The initiative came from the Visual Studio Code community. They actually run the complete tooling inside the container, even their IDE. The configuration of the IDE – i.e. which extensions are to be installed – is also defined by the definition of the devcontainer.
While you technically don’t need to use devcontainers even though your
team is using them, it is convenient for you also to use devcontainers
at least to some degree. Of course, you won’t install an Emacs instance
inside the devcontainer, but it is really helpful for you to manage
devcontainers from within Emacs and interact with the installation of
your software inside of it. That’s where the devcontainer package
comes in.
devcontainer provides a set Emacs commands to build, launch,
stop, erase and rebuild the devcontainer according to its definition in
the project’s repo. In order for you to run and test your software
inside the devcontainer, devcontainer-mode advises Emacs’
compilation-start function to prepend
devcontainer exec --workspace-folder . to your compilation
command and thus runs the compilation command inside the container.
Usually you would mount your local working directory into your
devcontainer. Then you edit files just like without using devcontainer.
Then, launching any kind of compile command, it is actually
performed inside your devcontainer.