Skip to content

Add modern Dockerfile for headless usage (#70)#159

Merged
zihuaihuai merged 1 commit into
masterfrom
add-modern-dockerfile-70
May 4, 2026
Merged

Add modern Dockerfile for headless usage (#70)#159
zihuaihuai merged 1 commit into
masterfrom
add-modern-dockerfile-70

Conversation

@zihuaihuai

Copy link
Copy Markdown
Collaborator

Replaces the 4-year-old Neurodocker draft in #70.

Why not iterate on #70

The original draft was generated by Neurodocker 0.6.0 in 2020-02. It pins Python 3.7 (EOL since 2023-06), ubuntu:latest (which has rolled 18.04 → 24.04 since the file was generated), pulls requirements.txt from a fork branch at build time, and pip installs BrainSpace itself from a fork branch. None of those will resolve cleanly today, so reviving it is more work than starting fresh.

What this is

Single ~50-line Dockerfile based on python:3.11-slim:

  • Non-root user (brainspace).
  • Installs BrainSpace from the in-repo source via pip install .[examples] — no fork URLs.
  • Headless rendering: replaces the default vtk with vtk-osmesa so plot_hemispheres works without an X display in Docker.
  • Jupyter Lab ships on port 8888 (no token / password — for local containers; production users should set JUPYTER_TOKEN).

What about Singularity / Apptainer?

The original PR included a separate Singularity recipe; that's no longer needed because Apptainer can build a SIF directly from a Docker image:

apptainer build brainspace.sif docker-daemon://brainspace:latest

Test plan

Closes #70. @ReinderVosDeWael / @PeerHerholz credited as Co-authors on the squashed commit.

Replaces the 4-year-old Neurodocker draft in #70 (which pinned Python
3.7 EOL, pulled requirements from a fork branch, and won't build today)
with a minimal current image:

- python:3.11-slim base, non-root user
- Installs BrainSpace from the in-repo source via pip install .[examples]
  (no fork URLs)
- Replaces vtk with vtk-osmesa for headless software rendering, so
  plot_hemispheres works in Docker without an X display
- Ships a Jupyter Lab server on port 8888

Apptainer users can derive a SIF directly:
  apptainer build brainspace.sif docker-daemon://brainspace:latest
so the separate Singularity recipe from #70 is no longer needed.

.dockerignore excludes build artifacts, tests, and IDE noise so the
image stays small.

Closes #70.

Co-authored-by: Reinder Vos de Wael <ReinderVosDeWael@users.noreply.github.com>
Co-authored-by: Peer Herholz <PeerHerholz@users.noreply.github.com>
@zihuaihuai zihuaihuai merged commit 54a99f5 into master May 4, 2026
16 checks passed
@zihuaihuai zihuaihuai deleted the add-modern-dockerfile-70 branch May 4, 2026 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant