Skip to content

Devcontainers cleanup #513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
Mar 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
a82b0fb
Remove mention of completely
ewels Feb 18, 2025
322eb0f
Consolidate Dockerfiles
ewels Feb 18, 2025
5b7d253
Change base image, remove some stuff I hope isn't needed
ewels Feb 18, 2025
d485cef
Clean up devcontainer, move to Dockerfile
ewels Feb 18, 2025
76b756e
Fix syntax error in Dockerfile
ewels Feb 18, 2025
363d9e2
Merge branch 'master' into devcontainers-cleanup
ewels Feb 18, 2025
1b8be5c
Remove devcontainer 'remoteUser' 'gitpod'
ewels Feb 18, 2025
394bfc1
Inline comments to explain devcontainer config
ewels Feb 18, 2025
c91b490
Merge branch 'master' into devcontainers-cleanup
pinin4fjords Feb 27, 2025
6bbfe27
Fix postCreateCommand if statement
ewels Feb 27, 2025
d3d3713
Add workflow_dispatch to docker GHA workflow
ewels Feb 27, 2025
f58886b
Change GHA logic for testing on forks
ewels Feb 27, 2025
9d7b067
Simplify GHA docker action
ewels Feb 27, 2025
1708f15
Fix env access
ewels Feb 27, 2025
8b98f17
Add permissions to push to registry
ewels Feb 27, 2025
0754ab6
Use github actions cache
ewels Feb 27, 2025
c159028
Set up buildx
ewels Feb 27, 2025
1a8042a
Update Nextflow to 24.10.4
ewels Feb 27, 2025
101cae0
Testing: Use pre-built image
ewels Feb 27, 2025
918fa6b
I take it back, it was the right way around already
ewels Feb 27, 2025
f3b73e0
Set user to root to fix permissions error with conda
ewels Feb 27, 2025
502e54b
Try removing common-utils to make codespaces boot faster
ewels Feb 27, 2025
b6df003
Run nextflow -version in postCreateCommand for devcontainer
ewels Feb 27, 2025
4ff37d3
Add back the nextflow org docker image
ewels Feb 28, 2025
264a925
Merge branch 'master' into devcontainers-cleanup
ewels Mar 5, 2025
0a6b45f
Merge branch 'master' into devcontainers-cleanup
pinin4fjords Mar 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 69 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,71 @@
FROM ghcr.io/nextflow-io/training:latest
FROM mcr.microsoft.com/devcontainers/universal:linux

ENV NXF_VER=24.10.0
USER root

# Install util tools.
# software-properties-common is needed to add ppa support for Apptainer installation
RUN apt-get update --quiet && \
export DEBIAN_FRONTEND=noninteractive && \
apt-get install --quiet --yes \
apt-transport-https \
apt-utils \
sudo \
git \
less \
wget \
curl \
tree \
graphviz \
software-properties-common && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Install Apptainer (Singularity)
RUN add-apt-repository -y ppa:apptainer/ppa && \
apt-get update --quiet && \
apt install -y apptainer && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Install Seqera Platform "Tower Agent"
RUN curl -fSL https://github.com/seqeralabs/tower-agent/releases/latest/download/tw-agent-linux-x86_64 > tw-agent && \
chmod +x tw-agent && \
mv tw-agent /usr/local/bin/tw-agent

# Set up directories
RUN mkdir -p /workspaces/.nextflow && \
mkdir -p /workspaces/training/

# Uncomment if we need to pin the Nextflow version
ENV NXF_EDGE=0
ENV NXF_VER=24.10.4
ENV NXF_HOME=/workspaces/.nextflow

# Install nextflow, nf-core, Mamba, and pytest-workflow
RUN conda config --remove channels defaults && \
conda config --add channels bioconda && \
conda config --add channels conda-forge && \
conda config --set channel_priority strict && \
conda update --quiet --yes --all && \
conda install --quiet --yes --name base \
mamba \
nextflow \
nf-core \
nf-test \
black \
prettier \
pre-commit \
linkify-it-py \
pytest-workflow && \
conda clean --all --force-pkgs-dirs --yes

# Cleanup
RUN printf 'unset JAVA_TOOL_OPTIONS\n' >> $HOME/.bashrc

# Update Nextflow
RUN nextflow self-update && nextflow -version

RUN unset JAVA_TOOL_OPTIONS

# RUN export PS1='\t -> '
RUN export PS1='\[\e[3;36m\]${PWD/*//} ->\[\e[0m\] '
36 changes: 17 additions & 19 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
{
"name": "nfcore",
"build": {
"dockerfile": "Dockerfile",
"context": ".."
},
"remoteUser": "gitpod",
"name": "nextflow-training",

// Update this to pin the release tag before release
"image": "ghcr.io/nextflow-io/training:latest",
// Uncomment this and comment "image" when testing Dockerfile changes
// "build": { "dockerfile": "Dockerfile", "context": ".." },

"features": {
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
"version": "latest"
}
},
"workspaceFolder": "/workspaces/training",
"workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/training,type=bind", // Used for local devcontainers, ignored in Codespaces.
"remoteEnv": {
"NXF_HOME": "/workspaces/.nextflow",
"HOST_PROJECT_PATH": "/workspaces/training" //Codespaces and local devcontainers will both work with this.
"HOST_PROJECT_PATH": "/workspaces/training" // Codespaces and local devcontainers will both work with this.
},
"postCreateCommand": "if [ -z \"$CODESPACES\" ]; then echo \"Local Development\"; else echo \"Codespaces Development\"; fi",
"postCreateCommand": "nextflow -version; if [ -z \"$CODESPACES\" ]; then echo \"Devcontainers Development\"; else echo \"Codespaces Development\"; fi",
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
Expand All @@ -27,17 +30,12 @@
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
"nf-core.nf-core-extensionpack",
"nextflow.nextflow",
"codezombiech.gitignore"
"nf-core.nf-core-extensionpack", // nf-core recommended extensions
"nextflow.nextflow", // Nextflow VS Code extension
"codezombiech.gitignore", // Language support for .gitignore files
"cssho.vscode-svgviewer" // SVG viewer
]
}
},
"portsAttributes": {
"3000": {
"label": "Application",
"onAutoForward": "openPreview"
}
},
"postCreateCommand": "mkdir -p /workspace && ln -s /workspaces /workspace/gitpod"
"remoteUser": "root"
}
76 changes: 0 additions & 76 deletions .github/gitpod.Dockerfile

This file was deleted.

57 changes: 34 additions & 23 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,37 @@
# Build and push the Docker image for Gitpod
# Build and push the Docker image for GitHub Codespaces
# - Only pushes if push or release
# - Builds without push for PRs to check the Dockerfile

name: Build Gitpod Docker image
name: Docker image

on:
pull_request:
push:
branches: [master]
release:
types: [published]
pull_request: # Build, don't push
push: { branches: [master] } # Build + push ('latest' tag)
release: { types: [published] } # Build + push (release tag)
workflow_dispatch: # Build + push (custom tag)
inputs:
tag_name:
description: "Docker image tag name"
type: string
required: true

jobs:
push_to_registry:
if: github.repository == 'nextflow-io/training'
name: Build + Push Gitpod Docker image
build_push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Set tag variable
run: |
if [[ '${{ github.event_name }}' == 'release' ]]; then
echo "IMAGE_TAG=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
elif [[ '${{ github.event_name }}' == 'workflow_dispatch' ]]; then
echo "IMAGE_TAG=${{ inputs.tag_name }}" >> $GITHUB_ENV
else
echo "IMAGE_TAG=latest" >> $GITHUB_ENV
fi

- name: Check out the repo
uses: actions/checkout@v4

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

- name: Build / push latest image
uses: docker/build-push-action@v5
if: github.event_name != 'release'
with:
file: .github/gitpod.Dockerfile
push: ${{ github.event_name == 'push' }}
tags: ghcr.io/nextflow-io/training:latest
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Push release image
uses: docker/build-push-action@v5
if: github.event_name == 'release'
- name: Build / push image
uses: docker/build-push-action@v6
with:
file: .github/gitpod.Dockerfile
push: true
tags: ghcr.io/nextflow-io/training:${{ github.event.release.tag_name }}
file: .devcontainer/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ghcr.io/${{ github.repository }}:${{ env.IMAGE_TAG }}
cache-from: type=gha
cache-to: type=gha,mode=max
2 changes: 1 addition & 1 deletion .github/workflows/mkdocs-docker.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Build and push the Docker image for building the site (mkdocs material)

name: Build mkdocs docker image
name: MkDocs image

on:
pull_request:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.0"
"nextflow": "24.10.4"
},
"timestamp": "2025-02-19T11:57:20.215132756"
}
Expand Down