Skip to content

Commit cc927b4

Browse files
authored
Merge pull request #361 from CMonnin/feat/podman-dev-env
add terminal-based dev environment as alternative to devcontainers
2 parents 83f36bd + f176291 commit cc927b4

4 files changed

Lines changed: 225 additions & 0 deletions

File tree

.dev/README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Container Dev Environment
2+
3+
Alternative to VS Code devcontainers for nf-neuro development. The Dockerfiles work with both Docker and Podman. The `dev` helper script uses Podman.
4+
5+
## Prerequisites
6+
7+
- [Podman](https://podman.io/) (for the `dev` script) or [Docker](https://docs.docker.com/get-docker/)
8+
9+
## Usage
10+
11+
```bash
12+
# Prototyping (default) — includes scilus tools
13+
.dev/dev
14+
15+
# DevOps — includes CI tools (act, actionlint, nf-test, prettier)
16+
.dev/dev devops
17+
18+
# Mount extra volumes
19+
.dev/dev -v /data:/data
20+
```
21+
22+
## Building Manually
23+
24+
```bash
25+
# With Podman
26+
podman build -t nf-neuro-prototyping .dev/prototyping/
27+
podman build -t nf-neuro-devops .dev/devops/
28+
29+
# With Docker
30+
docker build -t nf-neuro-prototyping .dev/prototyping/
31+
docker build -t nf-neuro-devops .dev/devops/
32+
```
33+
34+
## Running Tests
35+
36+
```bash
37+
nf-test test --profile apptainer,devcontainer
38+
```
39+
40+
## Installing Dependencies
41+
42+
```bash
43+
uv sync --no-install-project
44+
```
45+
46+
## Environment Variables
47+
48+
- `NF_NEURO_DEV_FLAVOR` — default flavor (`prototyping` or `devops`)
49+
- `NF_NEURO_DEV_IMAGE` — override container image name

.dev/dev

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5+
DEFAULT_FLAVOR="${NF_NEURO_DEV_FLAVOR:-prototyping}"
6+
7+
flavor="$DEFAULT_FLAVOR"
8+
if [[ ${1:-} == "devops" || ${1:-} == "prototyping" ]]; then
9+
flavor="$1"
10+
shift
11+
fi
12+
13+
volumes=()
14+
while [[ ${1:-} == -v ]]; do
15+
shift
16+
volumes+=(-v "$1")
17+
shift
18+
done
19+
20+
context="${REPO_ROOT}/.dev/${flavor}"
21+
image="${NF_NEURO_DEV_IMAGE:-nf-neuro-${flavor}:local}"
22+
23+
if [[ ! -f "${context}/Dockerfile" ]]; then
24+
echo "no Dockerfile at ${context}" >&2
25+
exit 1
26+
fi
27+
28+
podman build -t "$image" "$context"
29+
30+
exec podman run --rm -it \
31+
--privileged \
32+
--device /dev/fuse \
33+
--userns=keep-id \
34+
-v "${REPO_ROOT}:/workspace" \
35+
-w /workspace \
36+
-v "nf-neuro-${flavor}-venv:/workspace/.venv:U" \
37+
-v "nf-neuro-${flavor}-cache:/home/ubuntu/.cache:U" \
38+
-v "nf-neuro-${flavor}-nextflow:/workspace/.nextflow:U" \
39+
"${volumes[@]}" \
40+
"$image" \
41+
"${@:-bash}"

.dev/devops/Dockerfile

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
FROM docker.io/ubuntu:24.04
2+
3+
ARG NODE_MAJOR=20
4+
ARG ACTIONLINT_VERSION=1.7.7
5+
ARG NEXTFLOW_VERSION=25.04.6
6+
ARG NFTEST_VERSION=0.9.3
7+
8+
ENV DEBIAN_FRONTEND=noninteractive
9+
10+
RUN apt-get update && apt-get install -y --no-install-recommends \
11+
ca-certificates \
12+
curl \
13+
git \
14+
gnupg \
15+
jq \
16+
openjdk-17-jre-headless \
17+
python3 \
18+
shellcheck \
19+
software-properties-common \
20+
sudo \
21+
tmux \
22+
squashfs-tools \
23+
uidmap \
24+
fuse \
25+
fuse2fs \
26+
&& add-apt-repository -y ppa:apptainer/ppa \
27+
&& apt-get update \
28+
&& apt-get install -y --no-install-recommends apptainer \
29+
&& rm -rf /var/lib/apt/lists/*
30+
31+
RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_MAJOR}.x | bash - \
32+
&& apt-get install -y --no-install-recommends nodejs \
33+
&& rm -rf /var/lib/apt/lists/* \
34+
&& groupadd --gid 1010 nodeusers \
35+
&& mkdir -p -m 0775 /usr/local/lib/node_modules \
36+
&& chown -R root:nodeusers /usr/local/lib/node_modules
37+
38+
RUN curl -fsSL https://raw.githubusercontent.com/nektos/act/master/install.sh | bash \
39+
&& curl -fsSL "https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/actionlint_${ACTIONLINT_VERSION}_linux_amd64.tar.gz" \
40+
| tar xz -C /usr/local/bin actionlint \
41+
&& chmod u+x /usr/local/bin/actionlint
42+
43+
# GitHub CLI
44+
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
45+
-o /usr/share/keyrings/githubcli-archive-keyring.gpg \
46+
&& chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
47+
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" \
48+
> /etc/apt/sources.list.d/github-cli.list \
49+
&& apt-get update \
50+
&& apt-get install -y --no-install-recommends gh \
51+
&& rm -rf /var/lib/apt/lists/*
52+
53+
# Nextflow
54+
RUN curl -fsSL https://get.nextflow.io | NXF_VER=${NEXTFLOW_VERSION} bash \
55+
&& mv nextflow /usr/local/bin/nextflow \
56+
&& chmod u+x /usr/local/bin/nextflow
57+
58+
RUN npm install -g --save-exact prettier \
59+
&& npm install -g editorconfig editorconfig-checker
60+
61+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
62+
63+
RUN usermod -aG nodeusers ubuntu \
64+
&& echo "ubuntu ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/ubuntu \
65+
&& chmod u=r,g=r /etc/sudoers.d/ubuntu \
66+
&& echo "prefix=/usr/local" >> /home/ubuntu/.npmrc
67+
68+
ENV PATH="/home/ubuntu/.local/bin:${PATH}"
69+
ENV NXF_APPTAINER_CACHEDIR=/home/ubuntu/.cache/apptainer
70+
71+
USER ubuntu
72+
WORKDIR /home/ubuntu
73+
74+
RUN mkdir -p .local/bin \
75+
&& curl -fsSL https://code.askimed.com/install/nf-test | bash -s ${NFTEST_VERSION} \
76+
&& mv nf-test /home/ubuntu/.local/bin/nf-test \
77+
&& chmod u+x /home/ubuntu/.local/bin/nf-test
78+
79+
WORKDIR /workspace
80+
CMD ["bash"]

.dev/prototyping/Dockerfile

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
FROM docker.io/scilus/scilus:2.2.2
2+
3+
ARG NEXTFLOW_VERSION=25.04.6
4+
ARG NFTEST_VERSION=0.9.3
5+
6+
ENV DEBIAN_FRONTEND=noninteractive
7+
8+
RUN apt-get update && apt-get install -y --no-install-recommends \
9+
ca-certificates \
10+
curl \
11+
git \
12+
gnupg \
13+
openjdk-17-jre \
14+
software-properties-common \
15+
sudo \
16+
tmux \
17+
squashfs-tools \
18+
uidmap \
19+
fuse \
20+
fuse2fs \
21+
&& add-apt-repository -y ppa:apptainer/ppa \
22+
&& apt-get update \
23+
&& apt-get install -y --no-install-recommends apptainer \
24+
&& rm -rf /var/lib/apt/lists/*
25+
26+
# GitHub CLI
27+
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
28+
-o /usr/share/keyrings/githubcli-archive-keyring.gpg \
29+
&& chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
30+
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" \
31+
> /etc/apt/sources.list.d/github-cli.list \
32+
&& apt-get update \
33+
&& apt-get install -y --no-install-recommends gh \
34+
&& rm -rf /var/lib/apt/lists/*
35+
36+
# Nextflow
37+
RUN curl -fsSL https://get.nextflow.io | NXF_VER=${NEXTFLOW_VERSION} bash \
38+
&& mv nextflow /usr/local/bin/nextflow \
39+
&& chmod u+x /usr/local/bin/nextflow
40+
41+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
42+
43+
USER ubuntu
44+
WORKDIR /home/ubuntu
45+
46+
ENV PATH="/home/ubuntu/.local/bin:${PATH}"
47+
ENV NXF_APPTAINER_CACHEDIR=/home/ubuntu/.cache/apptainer
48+
49+
RUN mkdir -p .local/bin \
50+
&& curl -fsSL https://code.askimed.com/install/nf-test | bash -s ${NFTEST_VERSION} \
51+
&& mv nf-test /home/ubuntu/.local/bin/nf-test \
52+
&& chmod u+x /home/ubuntu/.local/bin/nf-test
53+
54+
WORKDIR /workspace
55+
CMD ["bash"]

0 commit comments

Comments
 (0)