Skip to content

Commit 3168758

Browse files
authored
Merge pull request #513 from nextflow-io/devcontainers-cleanup
Devcontainers cleanup
2 parents 99df8a2 + 0a6b45f commit 3168758

File tree

6 files changed

+122
-122
lines changed

6 files changed

+122
-122
lines changed

.devcontainer/Dockerfile

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,71 @@
1-
FROM ghcr.io/nextflow-io/training:latest
1+
FROM mcr.microsoft.com/devcontainers/universal:linux
22

3-
ENV NXF_VER=24.10.0
3+
USER root
4+
5+
# Install util tools.
6+
# software-properties-common is needed to add ppa support for Apptainer installation
7+
RUN apt-get update --quiet && \
8+
export DEBIAN_FRONTEND=noninteractive && \
9+
apt-get install --quiet --yes \
10+
apt-transport-https \
11+
apt-utils \
12+
sudo \
13+
git \
14+
less \
15+
wget \
16+
curl \
17+
tree \
18+
graphviz \
19+
software-properties-common && \
20+
apt-get clean && \
21+
rm -rf /var/lib/apt/lists/*
22+
23+
# Install Apptainer (Singularity)
24+
RUN add-apt-repository -y ppa:apptainer/ppa && \
25+
apt-get update --quiet && \
26+
apt install -y apptainer && \
27+
apt-get clean && \
28+
rm -rf /var/lib/apt/lists/*
29+
30+
# Install Seqera Platform "Tower Agent"
31+
RUN curl -fSL https://github.com/seqeralabs/tower-agent/releases/latest/download/tw-agent-linux-x86_64 > tw-agent && \
32+
chmod +x tw-agent && \
33+
mv tw-agent /usr/local/bin/tw-agent
34+
35+
# Set up directories
36+
RUN mkdir -p /workspaces/.nextflow && \
37+
mkdir -p /workspaces/training/
38+
39+
# Uncomment if we need to pin the Nextflow version
440
ENV NXF_EDGE=0
41+
ENV NXF_VER=24.10.4
42+
ENV NXF_HOME=/workspaces/.nextflow
43+
44+
# Install nextflow, nf-core, Mamba, and pytest-workflow
45+
RUN conda config --remove channels defaults && \
46+
conda config --add channels bioconda && \
47+
conda config --add channels conda-forge && \
48+
conda config --set channel_priority strict && \
49+
conda update --quiet --yes --all && \
50+
conda install --quiet --yes --name base \
51+
mamba \
52+
nextflow \
53+
nf-core \
54+
nf-test \
55+
black \
56+
prettier \
57+
pre-commit \
58+
linkify-it-py \
59+
pytest-workflow && \
60+
conda clean --all --force-pkgs-dirs --yes
61+
62+
# Cleanup
63+
RUN printf 'unset JAVA_TOOL_OPTIONS\n' >> $HOME/.bashrc
64+
65+
# Update Nextflow
66+
RUN nextflow self-update && nextflow -version
67+
68+
RUN unset JAVA_TOOL_OPTIONS
69+
70+
# RUN export PS1='\t -> '
71+
RUN export PS1='\[\e[3;36m\]${PWD/*//} ->\[\e[0m\] '

.devcontainer/devcontainer.json

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
{
2-
"name": "nfcore",
3-
"build": {
4-
"dockerfile": "Dockerfile",
5-
"context": ".."
6-
},
7-
"remoteUser": "gitpod",
2+
"name": "nextflow-training",
3+
4+
// Update this to pin the release tag before release
5+
"image": "ghcr.io/nextflow-io/training:latest",
6+
// Uncomment this and comment "image" when testing Dockerfile changes
7+
// "build": { "dockerfile": "Dockerfile", "context": ".." },
8+
89
"features": {
9-
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
10+
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
11+
"version": "latest"
12+
}
1013
},
1114
"workspaceFolder": "/workspaces/training",
1215
"workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/training,type=bind", // Used for local devcontainers, ignored in Codespaces.
1316
"remoteEnv": {
1417
"NXF_HOME": "/workspaces/.nextflow",
15-
"HOST_PROJECT_PATH": "/workspaces/training" //Codespaces and local devcontainers will both work with this.
18+
"HOST_PROJECT_PATH": "/workspaces/training" // Codespaces and local devcontainers will both work with this.
1619
},
17-
"postCreateCommand": "if [ -z \"$CODESPACES\" ]; then echo \"Local Development\"; else echo \"Codespaces Development\"; fi",
20+
"postCreateCommand": "nextflow -version; if [ -z \"$CODESPACES\" ]; then echo \"Devcontainers Development\"; else echo \"Codespaces Development\"; fi",
1821
// Configure tool-specific properties.
1922
"customizations": {
2023
// Configure properties specific to VS Code.
@@ -27,17 +30,12 @@
2730
"extensions": [
2831
"ms-python.python",
2932
"ms-python.vscode-pylance",
30-
"nf-core.nf-core-extensionpack",
31-
"nextflow.nextflow",
32-
"codezombiech.gitignore"
33+
"nf-core.nf-core-extensionpack", // nf-core recommended extensions
34+
"nextflow.nextflow", // Nextflow VS Code extension
35+
"codezombiech.gitignore", // Language support for .gitignore files
36+
"cssho.vscode-svgviewer" // SVG viewer
3337
]
3438
}
3539
},
36-
"portsAttributes": {
37-
"3000": {
38-
"label": "Application",
39-
"onAutoForward": "openPreview"
40-
}
41-
},
42-
"postCreateCommand": "mkdir -p /workspace && ln -s /workspaces /workspace/gitpod"
40+
"remoteUser": "root"
4341
}

.github/gitpod.Dockerfile

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

.github/workflows/docker.yml

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,37 @@
1-
# Build and push the Docker image for Gitpod
1+
# Build and push the Docker image for GitHub Codespaces
22
# - Only pushes if push or release
33
# - Builds without push for PRs to check the Dockerfile
44

5-
name: Build Gitpod Docker image
5+
name: Docker image
66

77
on:
8-
pull_request:
9-
push:
10-
branches: [master]
11-
release:
12-
types: [published]
8+
pull_request: # Build, don't push
9+
push: { branches: [master] } # Build + push ('latest' tag)
10+
release: { types: [published] } # Build + push (release tag)
11+
workflow_dispatch: # Build + push (custom tag)
12+
inputs:
13+
tag_name:
14+
description: "Docker image tag name"
15+
type: string
16+
required: true
1317

1418
jobs:
15-
push_to_registry:
16-
if: github.repository == 'nextflow-io/training'
17-
name: Build + Push Gitpod Docker image
19+
build_push:
1820
runs-on: ubuntu-latest
21+
permissions:
22+
contents: read
23+
packages: write
1924
steps:
25+
- name: Set tag variable
26+
run: |
27+
if [[ '${{ github.event_name }}' == 'release' ]]; then
28+
echo "IMAGE_TAG=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
29+
elif [[ '${{ github.event_name }}' == 'workflow_dispatch' ]]; then
30+
echo "IMAGE_TAG=${{ inputs.tag_name }}" >> $GITHUB_ENV
31+
else
32+
echo "IMAGE_TAG=latest" >> $GITHUB_ENV
33+
fi
34+
2035
- name: Check out the repo
2136
uses: actions/checkout@v4
2237

@@ -27,18 +42,14 @@ jobs:
2742
username: ${{ github.repository_owner }}
2843
password: ${{ secrets.GITHUB_TOKEN }}
2944

30-
- name: Build / push latest image
31-
uses: docker/build-push-action@v5
32-
if: github.event_name != 'release'
33-
with:
34-
file: .github/gitpod.Dockerfile
35-
push: ${{ github.event_name == 'push' }}
36-
tags: ghcr.io/nextflow-io/training:latest
45+
- name: Set up Docker Buildx
46+
uses: docker/setup-buildx-action@v3
3747

38-
- name: Push release image
39-
uses: docker/build-push-action@v5
40-
if: github.event_name == 'release'
48+
- name: Build / push image
49+
uses: docker/build-push-action@v6
4150
with:
42-
file: .github/gitpod.Dockerfile
43-
push: true
44-
tags: ghcr.io/nextflow-io/training:${{ github.event.release.tag_name }}
51+
file: .devcontainer/Dockerfile
52+
push: ${{ github.event_name != 'pull_request' }}
53+
tags: ghcr.io/${{ github.repository }}:${{ env.IMAGE_TAG }}
54+
cache-from: type=gha
55+
cache-to: type=gha,mode=max

.github/workflows/mkdocs-docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Build and push the Docker image for building the site (mkdocs material)
22

3-
name: Build mkdocs docker image
3+
name: MkDocs image
44

55
on:
66
pull_request:

side-quests/solutions/nf-test/tests/main.converttoupper.nf.test.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
],
1010
"meta": {
1111
"nf-test": "0.9.2",
12-
"nextflow": "24.10.0"
12+
"nextflow": "24.10.4"
1313
},
1414
"timestamp": "2025-02-19T11:57:20.215132756"
1515
}

0 commit comments

Comments
 (0)