-
Notifications
You must be signed in to change notification settings - Fork 236
chore: add dev container support for simplicity #581
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| FROM ubuntu:24.04 | ||
|
|
||
| ENV DEBIAN_FRONTEND=noninteractive | ||
|
|
||
| # netplan dependencies | ||
| RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
| bash-completion \ | ||
| build-essential \ | ||
| cmake \ | ||
| gcovr \ | ||
| libcmocka-dev \ | ||
| libglib2.0-dev \ | ||
| libsystemd-dev \ | ||
| libyaml-dev \ | ||
| meson \ | ||
| network-manager \ | ||
| pandoc \ | ||
| pkg-config \ | ||
| pycodestyle \ | ||
| pyflakes3 \ | ||
| python3-cffi \ | ||
| python3-coverage \ | ||
| python3-dev \ | ||
| python3-pytest \ | ||
| python3-pytest-cov \ | ||
| python3-yaml \ | ||
| systemd \ | ||
| udev \ | ||
| uuid-dev \ | ||
| && apt-get clean \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # devcontainer dependencies | ||
| RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
| git \ | ||
| sudo \ | ||
| && apt-get clean \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| RUN echo "ubuntu ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/ubuntu \ | ||
| && chmod 0440 /etc/sudoers.d/ubuntu | ||
|
|
||
| WORKDIR /workspace | ||
|
|
||
| USER ubuntu | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "name": "Netplan Development", | ||
| "build": { | ||
| "dockerfile": "Dockerfile", | ||
| "context": ".." | ||
| }, | ||
| "remoteUser": "ubuntu" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,32 +39,29 @@ To contribute documentation, these steps should get you started: | |
|
|
||
| If you face issues, refer to our [comprehensive contribution guide](https://netplan.readthedocs.io/en/stable/contribute-docs/). | ||
|
|
||
| # Build dependencies | ||
| # Development Container | ||
|
|
||
| A Docker-based development environment is available via `.devcontainer/` for consistent builds across machines. | ||
|
|
||
| ## Using the Dev Container | ||
|
|
||
| ### With VS Code | ||
|
|
||
| Install the required build and test dependencies (Ubuntu/Debian): | ||
| 1. Install the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) | ||
| 2. Open the workspace in a container: Open the Command Palette and run "Dev Containers: Reopen in Container" | ||
| 3. The container automatically installs all dependencies and configures the `ubuntu` user | ||
|
|
||
| ### Manual Docker Build | ||
|
|
||
| ```sh | ||
| sudo apt install \ | ||
| build-essential \ | ||
| pkg-config \ | ||
| meson \ | ||
| libglib2.0-dev \ | ||
| libyaml-dev \ | ||
| libsystemd-dev \ | ||
| uuid-dev \ | ||
| bash-completion \ | ||
| python3-dev \ | ||
| python3-cffi \ | ||
| python3-coverage \ | ||
| python3-pytest \ | ||
| python3-pytest-cov \ | ||
| pyflakes3 \ | ||
| pycodestyle \ | ||
| libcmocka-dev \ | ||
| gcovr \ | ||
| pandoc | ||
| $ docker build -t netplan-dev -f .devcontainer/Dockerfile . | ||
| $ docker run -it --rm -v $(pwd):/workspace --name netplan-dev netplan-dev bash | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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 Do you know why?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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 Do you know why? I'm guessing it's an error with non-relative directories (the error references There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @benhoyt I did not run into this issue. I am running this container build from within an Ubuntu VM and is compiling fine. As you had mentioned, it is likely due to difference in the directory referred during the build.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe it's caused by the volume not being mounted correctly, |
||
| ``` | ||
|
|
||
| # Build dependencies | ||
|
|
||
| For a manual setup without containers, install the required build and test dependencies. The full list of dependencies is defined in [`.devcontainer/Dockerfile`](.devcontainer/Dockerfile#L6) under the `# netplan dependencies` section. | ||
|
|
||
| # Build using Meson | ||
|
|
||
| A Makefile wrapper is also provided for simplified usage. For that approach, please refer to the [Build using Makefile](#build-using-makefile) section below. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.