[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Dev workflow in Emacs with containers
From: |
Yuri Khan |
Subject: |
Re: Dev workflow in Emacs with containers |
Date: |
Sat, 30 Nov 2024 00:32:49 +0700 |
On Fri, 29 Nov 2024 at 21:41, Sébastien Gendre <seb@k-7.ch> wrote:
> Emacs provide some great tools to integrate with the dev workflow:
>
> These tools are great when the complied/tested/debugged/run software is
> local. But I use more and more the containers. Even for micro-controller
> firmware dev.
>
> My questions are:
>
> What are your experience with using Emacs, the tools cited above and
> containers ?
Emacs integrates excellently with containerized tools.
> Do you use a `.dir-locals.el` to set the commands run by Emacs to
> debugg/compile/etc ? Or do you use a Makefile with pre-defined targets
> for test, debug, build, etc ?
1. I have a Dockerfile or several that describes the build
environment. If necessary, a different one that describes the
runtime/debugging environment.
2. I have a docker-compose.yml which utilizes the image(s) built from
Dockerfile(s) of step 1, and mounts the source tree, the build
directory, etc into service containers. The compose file also arranges
for the services to run as my user ID so that I don’t get root-owned
files in my build tree.
The purpose of the compose file is to remember all the docker run
options for me so that I don’t have to specify them every time. I
could alternatively use shell scripts.
3. I also have a Makefile that encapsulates the build logic. In some
targets, it arranges for itself to execute in a service container
(with a different target). The purpose of the Makefile is that I could
run it either from Emacs or from local shell if I so desire.
4. .dir-locals.el to tell Emacs to use ‘docker-compose run --rm
runtime gdb’ as my debugger and ‘docker-compose run --rm builder
clangd’ as my language server, and ‘make build test’ as my compile
command.
> How do you manage when Emacs highlight a link to a file, but the
> obtained path correspond to the container file system while Emacs can
> access this file from the host file system ?
Where practical, I prefer to mount my volumes at the same paths in the
container as locally, this simplifies the mapping a lot. But in some
cases I hook ‘compilation-filter’ to a function that replaces
prefixes.