chore: add dev container support for simplicity#581
chore: add dev container support for simplicity#581Tony-WLB wants to merge 2 commits intocanonical:mainfrom
Conversation
|
|
||
| WORKDIR /workspace | ||
|
|
||
| USER netplan |
There was a problem hiding this comment.
Let's try to use the default ubuntu user to avoid having to do useradd/usermod and stuff.
There was a problem hiding this comment.
The user is changed to the default ubuntu.
| python3-pytest \ | ||
| python3-pytest-cov \ | ||
| python3-yaml \ | ||
| sudo \ |
There was a problem hiding this comment.
Is this really needed? Isn't it installed by default in ubuntu?
There was a problem hiding this comment.
Yes, I double-checked that the sudo package is not included by default in the Docker Ubuntu image.
|
|
||
| ```sh | ||
| sudo apt install \ | ||
| bash-completion \ |
There was a problem hiding this comment.
As mentioned above, we can link to the Dockerfile here for the list of deps, to avoid them getting out of sync.
There was a problem hiding this comment.
Done. This part refers to the # netplan dependencies section in the Dockerfile now.
|
|
||
| # Build dependencies | ||
|
|
||
| > If you prefer using a prebuilt development environment, see the dev container image definition in [`.devcontainer/Dockerfile`](.devcontainer/Dockerfile). |
There was a problem hiding this comment.
Let's add a few commands for how you use Docker to start a container in your terminal. Something like this (completely untested):
docker build
docker run ./myfile
$ make
$ ./netplan foo # or "make run"?
There was a problem hiding this comment.
The build and run command examples have been added.
| gcovr \ | ||
| pandoc | ||
| $ docker build -t netplan-dev -f .devcontainer/Dockerfile . | ||
| $ docker run -it --rm -v $(pwd):/workspace --name netplan-dev netplan-dev bash |
There was a problem hiding this comment.
Thanks, this is helpful. However, I think to make this useful we have to be able to build netplan and run it, from within the container. But make in the container doesn't work:
ubuntu@c7be5a34e560:/workspace$ make
meson compile -C _build --verbose
INFO: autodetecting backend as ninja
INFO: calculating backend command to run: /usr/bin/ninja -C /workspace/_build -v
ninja: Entering directory `/workspace/_build'
ninja: error: '/home/ben.hoyt@canonical.com/w/netplan/features_h_generator.sh', needed by 'dbus/_features.h', missing and no known rule to make it
make: *** [Makefile:8: default] Error 1
Do you know why?
| gcovr \ | ||
| pandoc | ||
| $ docker build -t netplan-dev -f .devcontainer/Dockerfile . | ||
| $ docker run -it --rm -v $(pwd):/workspace --name netplan-dev netplan-dev bash |
There was a problem hiding this comment.
This is helpful, and works on my machine. However, I think to make this useful we have to be able to build and run netplan from within the container. But make doesn't work for me:
ubuntu@c7be5a34e560:/workspace$ make
meson compile -C _build --verbose
INFO: autodetecting backend as ninja
INFO: calculating backend command to run: /usr/bin/ninja -C /workspace/_build -v
ninja: Entering directory `/workspace/_build'
ninja: error: '/home/ben.hoyt@canonical.com/w/netplan/features_h_generator.sh', needed by 'dbus/_features.h', missing and no known rule to make it
make: *** [Makefile:8: default] Error 1
Do you know why? I'm guessing it's an error with non-relative directories (the error references /home/ben.hoyt@canonical.com/w/netplan but I think that should be /workspace inside the container).
This pull request introduces a development container setup to streamline onboarding and development for the Netplan project. It also completes the dependencies list.
Dev container environment:
.devcontainer/Dockerfile- define a reproducible Ubuntu 24.04-based development environment.devcontainer/devcontainer.json- configure the dev containerDocumentation updates:
README.mdto mention the new dev container as an alternative to manual dependency installation, and revised the dependency list to match the packages installed in the dev container.