diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index ea84709bc..37b8b208c 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -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\] ' diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index a507457af..270d07b70 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -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. @@ -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" } diff --git a/.github/gitpod.Dockerfile b/.github/gitpod.Dockerfile deleted file mode 100644 index 9354d1693..000000000 --- a/.github/gitpod.Dockerfile +++ /dev/null @@ -1,76 +0,0 @@ -FROM gitpod/workspace-base - -USER root - -# Install util tools. -# software-properties-common is needed to add ppa support for Apptainer installation -RUN apt-get update --quiet && \ - 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/* - -# Taken from: https://github.com/nf-core/tools/blob/master/nf_core/gitpod/gitpod.Dockerfile -# 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 Conda -RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \ - bash Miniconda3-latest-Linux-x86_64.sh -b -p /opt/conda && \ - rm Miniconda3-latest-Linux-x86_64.sh - -ENV PATH="/opt/conda/bin:$PATH" - -# User permissions -RUN mkdir -p /workspace/data \ - && chown -R gitpod:gitpod /opt/conda /workspace/data - -# Install 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 - -# Change user to gitpod -USER gitpod - -# Uncomment if we need to pin the Nextflow version -ENV NXF_EDGE=0 -ENV NXF_VER=24.10.0 - -# Install nextflow, nf-core, Mamba, and pytest-workflow -RUN conda config --add 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 - -# Update Nextflow -RUN nextflow self-update && nextflow -version - -RUN unset JAVA_TOOL_OPTIONS - -RUN export PS1='\t -> ' diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 1a02cb913..ffb5ddd3a 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -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 @@ -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 diff --git a/.github/workflows/mkdocs-docker.yml b/.github/workflows/mkdocs-docker.yml index 21877a34f..bb6debcc9 100644 --- a/.github/workflows/mkdocs-docker.yml +++ b/.github/workflows/mkdocs-docker.yml @@ -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: diff --git a/side-quests/solutions/nf-test/tests/main.converttoupper.nf.test.snap b/side-quests/solutions/nf-test/tests/main.converttoupper.nf.test.snap index c88737d92..3215234e8 100644 --- a/side-quests/solutions/nf-test/tests/main.converttoupper.nf.test.snap +++ b/side-quests/solutions/nf-test/tests/main.converttoupper.nf.test.snap @@ -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" }