8000 Add Dev Container setup for streamlining local development on Linux by ruffsl · Pull Request #8861 · Slicer/Slicer · GitHub 8000
[go: up one dir, main page]

Skip to content

Conversation

@ruffsl
Copy link
Contributor
@ruffsl ruffsl commented Nov 19, 2025

This pull request introduces a comprehensive Dev Container setup for the project, enabling reproducible development and build environments using Docker and BuildKit. It adds multi-stage Dockerfile instructions, configuration files for caching and environment, a detailed README for onboarding, and scripts for initializing the container. The changes are designed to streamline building, testing, and packaging workflows, and to support advanced development scenarios such as hardware acceleration and debugging.

Dev Container Infrastructure

  • Added a multi-stage .devcontainer/Dockerfile that defines separate stages for building, testing, packaging, and running Slicer, with extensive use of BuildKit cache mounts and environment configuration for efficient development.
  • Introduced .devcontainer/devcontainer.json to configure the Dev Container environment, including image selection, runtime arguments for hardware and debugging, workspace mounts, environment variables, and recommended extensions.

Developer Experience

  • Added .devcontainer/README.md with step-by-step instructions for setting up Docker, Git LFS, NVIDIA toolkit, and development tools, as well as guidance for building, running, and launching the Dev Container using CLI, VSCode, CodeSpaces, etc.

with Dockerfile, build scripts, and caching setup
before adding ubuntu user to sudoers file
to builder stage in devcontainer docker image
as GitHub CLI is being installed via apt already
to Dockerfile for configurable build type
caching cmake setup and make steps as seperate layers
as this setup isn't used for CI yet that could seed it's docker cache
by installing cmake for use of ctest
as .dockerignore ignores .git folder to uneccesary cache busting
which interfear in expected use of SlicerMacroExtractRepositoryInfo
and correct working dir for xvfb-run ctest comand
to simplify docker build bake DX for user
shorting the both CLI comand invocation
and avoid altering default context setting
As copying files 7.11GB from overlay takes too long for now.
@pieper
Copy link
Member
pieper commented Nov 20, 2025

Thanks for working on this, it seems quite promising 👍

I'm not really familiar with this approach. Would it allow us to have debug builds of the latest Slicer as images that could quickly start up, for example in a github codespace, to allow debugging of C++ code quickly and efficiently?

Are there examples of big projects like Slicer that provide Dev Containers so we can see how it works in practice?

as the severs for Ubuntu's snapshot repo have been slow recently
to emulate a Codespace runtime on a GitHub VM
to prevent nagging warning from display manager
that ships with devcontainers feature desktop-lite
@ruffsl
Copy link
Contributor Author
ruffsl commented Nov 20, 2025

Would it allow us to have debug builds of the latest Slicer as images that could quickly start up, for example in a github codespace, to allow debugging of C++ code quickly and efficiently?

Yep, we could extend the GitHub Actions to build and host pre-built debug images that could then be pulled into Codespaces for remote browser based development workflows.

For example, in 88aca1c I patched the config from I use for locally on my linux workstation, to what would be available from the remotely on the VM hosting a user's GitHub Codespace. Here I use a noVNC feature with VSCode port forwarding for display forwarding GUIs:

Note: Recording was set to 5FPS to fit a 4K capture of an entire bring up demo

simplescreenrecorder-2025-11-20_16.26.58.mp4

Are there examples of big projects like Slicer that provide Dev Containers so we can see how it works in practice?

I've developed setups like this before for FOSS and commercial projects, some examples:

- Development Containers
- https://docs.nav2.org/development_guides/devcontainer_docs/index.html

Additionally, pattern searching across github may help to find more popular example:

@pieper
Copy link
Member
pieper commented Nov 21, 2025

It sounds very useful. I'll be curious to hear what others think about this. @lassoan @sam @ebrahimebrahim @jcfr

@sjh26
Copy link
Contributor
sjh26 commented Nov 25, 2025

It would be great to discuss this a bit at a weekly meeting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0