Skip to content

Commit 0323822

Browse files
authored
Install devcontainer tools natively instead of using conda (#609)
* install nextflow and nf-test with bash instead of conda * devcontainer: install needed cli tools using uv
1 parent 29db3c5 commit 0323822

File tree

12 files changed

+101
-49
lines changed

12 files changed

+101
-49
lines changed

.devcontainer/codespaces-dev/devcontainer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@
1616
"ghcr.io/rocker-org/devcontainer-features/miniforge:2": {
1717
"version": "latest"
1818
},
19+
"ghcr.io/va-h/devcontainers-features/uv": {},
1920
"../local-features/apptainer": {},
2021
"../local-features/tower-agent": {},
21-
"../local-features/conda-packages": {}
22+
"../local-features/nextflow": {},
23+
"../local-features/conda-channels": {},
24+
"../local-features/uv-tools": {}
2225
},
2326
"workspaceFolder": "/workspaces/training",
2427
"remoteUser": "root",

.devcontainer/local-dev/devcontainer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@
1616
"ghcr.io/rocker-org/devcontainer-features/miniforge:2": {
1717
"version": "latest"
1818
},
19+
"ghcr.io/va-h/devcontainers-features/uv": {},
1920
"../local-features/apptainer": {},
2021
"../local-features/tower-agent": {},
21-
"../local-features/conda-packages": {}
22+
"../local-features/nextflow": {},
23+
"../local-features/conda-channels": {},
24+
"../local-features/uv-tools": {}
2225
},
2326
"workspaceFolder": "${localWorkspaceFolder}",
2427
"workspaceMount": "source=${localWorkspaceFolder},target=${localWorkspaceFolder},type=bind",
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"id": "conda-channels",
3+
"name": "Nextflow Training Conda Channels",
4+
"description": "Sets default conda channels for Nextflow Training",
5+
"installsAfter": ["ghcr.io/rocker-org/devcontainer-features/miniforge"]
6+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
# Install conda packages needed for Nextflow Training
4+
5+
conda config --add channels bioconda
6+
conda config --add channels conda-forge
7+
conda config --set channel_priority strict

.devcontainer/local-features/conda-packages/devcontainer-feature.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

.devcontainer/local-features/conda-packages/install.sh

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"id": "nextflow",
3+
"name": "Nextflow Installation",
4+
"description": "Install Nextflow and nf-test",
5+
"options": {
6+
"version": {
7+
"type": "string",
8+
"proposals": ["latest"],
9+
"default": "latest",
10+
"description": "Select or enter a version."
11+
}
12+
},
13+
"installsAfter": ["ghcr.io/devcontainers/features/java:1"]
14+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/usr/bin/env bash
2+
3+
set -eux
4+
USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}"
5+
NEXTFLOW_INSTALL_DIR=/usr/local/bin
6+
7+
if [ "$(id -u)" -ne 0 ]; then
8+
echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
9+
exit 1
10+
fi
11+
12+
# Determine the appropriate non-root user
13+
if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then
14+
USERNAME=""
15+
POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)")
16+
for CURRENT_USER in "${POSSIBLE_USERS[@]}"; do
17+
if id -u ${CURRENT_USER} > /dev/null 2>&1; then
18+
USERNAME=${CURRENT_USER}
19+
break
20+
fi
21+
done
22+
if [ "${USERNAME}" = "" ]; then
23+
USERNAME=root
24+
fi
25+
elif [ "${USERNAME}" = "none" ] || ! id -u ${USERNAME} > /dev/null 2>&1; then
26+
USERNAME=root
27+
fi
28+
29+
# Add the nextflow group if it doesn't exist
30+
if ! cat /etc/group | grep -e "^nextflow:" > /dev/null 2>&1; then
31+
groupadd -r nextflow
32+
fi
33+
# Add the user to the nextflow group
34+
usermod -a -G nextflow "${USERNAME}"
35+
36+
# Install Nextflow
37+
echo "Installing Nextflow..."
38+
cd $NEXTFLOW_INSTALL_DIR
39+
curl -s https://get.nextflow.io | bash
40+
41+
# Install nf-test
42+
echo "Installing nf-test..."
43+
cd $NEXTFLOW_INSTALL_DIR
44+
curl -fsSL https://get.nf-test.com | bash
45+
46+
# Set ownership and permissions on the nextflow and nf-test executables
47+
chown "${USERNAME}:nextflow" "${NEXTFLOW_INSTALL_DIR}"/nextflow
48+
chown "${USERNAME}:nextflow" "${NEXTFLOW_INSTALL_DIR}"/nf-test
49+
chmod g+r+w "${NEXTFLOW_INSTALL_DIR}"/nextflow
50+
chmod g+r+w "${NEXTFLOW_INSTALL_DIR}"/nf-test
51+
#find "${NEXTFLOW_INSTALL_DIR}" -type d -print0 | xargs -n 1 -0 chmod g+s
52+
53+
echo "Done!"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"id": "uv-tools",
3+
"name": "uv tools",
4+
"description": "Install required python cli tools using uv",
5+
"installsAfter": ["ghcr.io/va-h/devcontainers-features/uv"]
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
3+
# Install python cli tools using uv
4+
5+
uv tool install pre-commit
6+
uv tool install nf-core

0 commit comments

Comments
 (0)