add terminal-based dev environment as alternative to devcontainers#361
Conversation
Editor-agnostic setup using rootless podman + apptainer, replacing VSCode devcontainers + Docker-in-Docker. Existing .devcontainer/ configs are unchanged. Two flavors matching the existing devcontainer structure: - prototyping: scilus/scilus:2.0.2 base with nextflow, nf-test, poetry 1.8.5, apptainer, and gh CLI - devops: python:3.13-slim base with nextflow, nf-test, poetry 2.0.1, apptainer, gh CLI, node 20, act, actionlint, shellcheck, prettier, and editorconfig-checker Launcher script (.dev/dev) builds and runs the selected flavor with podman, bind-mounting the repo at /workspace. Named volumes persist .venv, .cache, and .nextflow across sessions. Supports extra bind mounts via -v flags for working with external dirs. Usage: .dev/dev # prototyping (default) .dev/dev devops # devops flavor .dev/dev -v /path:/path bash # mount extra directories Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
not sure if there's any interest in this but i don't use vscode or devcontainers so this is an alternative |
|
Please advise :) Is there a way to get as much common building info as possible at the same place instead of duplicating code ? |
do you mean between the devcontainers and these separate dockerfiles? |
|
nf version needs to be moved to 25 to match CI |
|
I think this PR should include some documentation updates on how this tool is intended to be used for development. |
Yes, once it works, some upgrades to the installation procedures on nf-neuro-documentation will need to be done. |
|
|
|
Tests working with |
gdevenyi
left a comment
There was a problem hiding this comment.
Needs docs on how to use.
| gnupg \ | ||
| jq \ | ||
| openjdk-17-jre \ | ||
| pipx \ |
| && mv nf-test /home/${USERNAME}/.local/bin/nf-test \ | ||
| && chmod +x /home/${USERNAME}/.local/bin/nf-test | ||
|
|
||
| RUN pipx install poetry==${POETRY_VERSION} |
| && chmod 0755 /usr/local/bin/nextflow | ||
|
|
||
| # pipx (system-wide) so the dev user can install poetry into ~/.local | ||
| RUN python3 -m pip install --no-cache-dir pipx |
There was a problem hiding this comment.
Had to add pipx to apt-get install above in 2.2.2 for it to work, still prefer uv
| RUN ARCH="$(dpkg --print-architecture)" \ | ||
| && curl -fsSL -o /tmp/apptainer.deb \ | ||
| "https://github.com/apptainer/apptainer/releases/download/v${APPTAINER_VERSION}/apptainer_${APPTAINER_VERSION}_${ARCH}.deb" \ | ||
| && apt-get update \ | ||
| && apt-get install -y --no-install-recommends /tmp/apptainer.deb \ | ||
| && rm -rf /var/lib/apt/lists/* /tmp/apptainer.deb |
There was a problem hiding this comment.
| # Apptainer (replaces ghcr.io/devcontainers/features/docker-in-docker) | ||
| RUN ARCH="$(dpkg --print-architecture)" \ | ||
| && curl -fsSL -o /tmp/apptainer.deb \ | ||
| "https://github.com/apptainer/apptainer/releases/download/v${APPTAINER_VERSION}/apptainer_${APPTAINER_VERSION}_${ARCH}.deb" \ | ||
| && apt-get update \ | ||
| && apt-get install -y --no-install-recommends /tmp/apptainer.deb \ | ||
| && rm -rf /var/lib/apt/lists/* /tmp/apptainer.deb |
There was a problem hiding this comment.
apptainer has a ppa apptainer.org/docs/admin/latest/installation.html#install-ubuntu-packages
| @@ -0,0 +1,96 @@ | |||
| FROM docker.io/python:3.13-slim-bookworm | |||
There was a problem hiding this comment.
The most likely user for nf-neuro is ubuntu, it probably makes more sense to base the test environments on it?
| && mv nf-test /home/${USERNAME}/.local/bin/nf-test \ | ||
| && chmod +x /home/${USERNAME}/.local/bin/nf-test | ||
|
|
||
| RUN pipx install poetry==${POETRY_VERSION} |
| @@ -0,0 +1,78 @@ | |||
| FROM docker.io/scilus/scilus:2.0.2 | |||
There was a problem hiding this comment.
very out of date, should be 2.2.2
There was a problem hiding this comment.
Swapping to 2.2.2 causes this build error, good reason for uv
--> f33d5b5fdabb
STEP 14/23: RUN python3 -m pip install --no-cache-dir pipx
/opt/venvs/scilpy/bin/python3: No module named pip
Error: building at STEP "RUN python3 -m pip install --no-cache-dir pipx": while running runtime: exit status 1
There was a problem hiding this comment.
Another bug on bump:
--> 65374466aed4
STEP 14/22: RUN groupadd --gid ${USER_GID} ${USERNAME} && useradd --uid ${USER_UID} --gid ${USER_GID} -m -s /bin/bash ${USERNAME} && echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/${USERNAME} && chmod 0440 /etc/sudoers.d/${USERNAME}
groupadd: GID '1000' already exists
Error: building at STEP "RUN groupadd --gid ${USER_GID} ${USERNAME} && useradd --uid ${USER_UID} --gid ${USER_GID} -m -s /bin/bash ${USERNAME} && echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/${USERNAME} && chmod 0440 /etc/sudoers.d/${USERNAME}": while running runtime: exit status 4
There was a problem hiding this comment.
Default user is ubuntu and already present in the container now
| sudo \ | ||
| tmux \ | ||
| vim \ | ||
| wget \ |
There was a problem hiding this comment.
no need for both wget and curl
| shellcheck \ | ||
| sudo \ | ||
| tmux \ | ||
| wget \ |
There was a problem hiding this comment.
no need for both wget and curl
| # Nextflow (was ghcr.io/robsyme/features/nextflow) | ||
| RUN curl -fsSL https://get.nextflow.io | NXF_VER=${NEXTFLOW_VERSION} bash \ | ||
| && mv nextflow /usr/local/bin/nextflow \ | ||
| && chmod 0755 /usr/local/bin/nextflow |
There was a problem hiding this comment.
we are modern people, chmod has symbolic permissions mode
| # Non-root user matching host UID (used with --userns=keep-id at runtime) | ||
| RUN groupadd --gid ${USER_GID} ${USERNAME} \ | ||
| && useradd --uid ${USER_UID} --gid ${USER_GID} -m -s /bin/bash ${USERNAME} \ | ||
| && echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/${USERNAME} \ | ||
| && chmod 0440 /etc/sudoers.d/${USERNAME} |
There was a problem hiding this comment.
Not needed for 2.2.2, just switch user to ubuntu
| ARG NFTEST_VERSION=0.9.3 | ||
| ARG APPTAINER_VERSION=1.4.1 | ||
| ARG POETRY_VERSION=1.8.5 | ||
| ARG USERNAME=dev |
There was a problem hiding this comment.
switch to ubuntu for 2.2.2
- Base image scilus/scilus:2.0.2 → 2.2.2 - Use built-in ubuntu user (no more user creation) - Replace pipx/poetry with uv (COPY --from ghcr.io/astral-sh/uv) - Install apptainer via PPA instead of .deb download - Remove wget, python3-pip, python3-venv - Bump Nextflow 24.10.5 → 25.04.6 to match CI - Use symbolic chmod Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Base image python:3.13-slim-bookworm → ubuntu:24.04 - Use built-in ubuntu user (usermod for groups only) - Replace pipx/poetry with uv (COPY --from ghcr.io/astral-sh/uv) - Install apptainer via PPA instead of .deb download - Remove wget, use openjdk-17-jre-headless (smaller) - Bump Nextflow 24.10.5 → 25.04.6 to match CI - Use symbolic chmod Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
It looks amazing. Great work ! |
There was a problem hiding this comment.
Pull request overview
Adds a terminal/editor-agnostic container dev environment under .dev/ as an alternative to the existing VS Code .devcontainer/ setup, aiming to provide reproducible tooling via Podman + Apptainer without requiring the devcontainer CLI.
Changes:
- Added a Podman-based launcher script (
.dev/dev) to build/run a selected dev “flavor” and persist caches/venvs via named volumes. - Added two new Dockerfile-based environments (
.dev/prototyping/and.dev/devops/) with Nextflow, nf-test, Apptainer, GitHub CLI, and additional CI tooling for devops. - Added
.dev/README.mddocumenting usage and manual build steps.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| .dev/README.md | Documents the new container-based dev environment and how to use it. |
| .dev/prototyping/Dockerfile | Defines the “prototyping” container image with Nextflow/nf-test/Apptainer tooling. |
| .dev/devops/Dockerfile | Defines the “devops” container image with additional CI/dev tooling (node/act/actionlint/etc.). |
| .dev/dev | Podman launcher script to build/run the chosen flavor with persistent volumes and optional extra mounts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv | ||
|
|
||
| RUN usermod -aG nodeusers ubuntu \ | ||
| && echo "ubuntu ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/ubuntu \ | ||
| && chmod u=r,g=r /etc/sudoers.d/ubuntu \ | ||
| && echo "prefix=/usr/local" >> /home/ubuntu/.npmrc | ||
|
|
||
| ENV PATH="/home/ubuntu/.local/bin:${PATH}" | ||
| ENV NXF_APPTAINER_CACHEDIR=/home/ubuntu/.cache/apptainer | ||
|
|
||
| USER ubuntu | ||
| WORKDIR /home/ubuntu | ||
|
|
| volumes=() | ||
| while [[ ${1:-} == -v ]]; do | ||
| shift | ||
| volumes+=(-v "$1") | ||
| shift | ||
| done |
| ## Installing Dependencies | ||
|
|
||
| ```bash | ||
| uv sync --no-install-project |
| COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv | ||
|
|
|
|
||
| COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv | ||
|
|
| FROM docker.io/ubuntu:24.04 | ||
|
|
||
| ARG NODE_MAJOR=20 | ||
| ARG ACTIONLINT_VERSION=1.7.7 | ||
| ARG NEXTFLOW_VERSION=25.04.6 | ||
| ARG NFTEST_VERSION=0.9.3 | ||
|
|
|
None of these co-pilot reviews are relevant, updated model works for me. |
|
Can this be merged? I'd like to use it to advance my registration too integration. |
Describe your improvement
Adds a podman + apptainer dev environment as an editor-agnostic alternative to the existing VSCode devcontainers. This lets contributors who don't use VSCode (e.g. nvim, Emacs, etc.) get the same reproducible tooling without needing Docker or the devcontainer CLI.
Existing
.devcontainer/configs are unchanged.Two flavors matching the existing devcontainer structure:
scilus/scilus:2.0.2base with nextflow, nf-test, poetry 1.8.5, apptainer, and gh CLIpython:3.13-slimbase with nextflow, nf-test, poetry 2.0.1, apptainer, gh CLI, node 20, act, actionlint, shellcheck, prettier, and editorconfig-checkerLauncher script (
.dev/dev) builds and runs the selected flavor with podman, bind-mounting the repo at/workspace. Named volumes persist.venv,.cache, and.nextflowacross sessions. Supports extra bind mounts via-vflags for working with external dirs.Usage
Note: The dev launcher script is podman-specific (uses --userns=keep-id and :U volume flags). The Dockerfiles are standard and can be built and run with any container runtime
(Docker, podman, etc.).
Note: When running nf-test inside the container, use --profile apptainer,devcontainer instead of the default docker profile (e.g. nf-test test --profile
apptainer,devcontainer).
Type of improvement
Describe how to test your improvement
Checklist before requesting a review
Tested and working on Void Linux (kernel 6.18 and kernel 7.03) with rootless podman. Other distros may need adjustments.