From 514d1d28232a59fdf5fb09d6f65164e7f064065a Mon Sep 17 00:00:00 2001 From: Robrecht Cannoodt Date: Tue, 13 Jun 2023 08:33:13 +0200 Subject: [PATCH] refactor into viash components --- .github/workflows/daily-build.yml | 75 +++++++++++++++++++ .github/workflows/docker-publish.yaml | 46 ------------ LICENSE | 2 +- _viash.yaml | 9 +++ base-python-3.10/README.md | 11 --- base-python-3.10/v1.0.0.Dockerfile | 14 ---- base-r2u-22.04/README.md | 13 ---- base-r2u-22.04/v1.0.0.Dockerfile | 17 ----- .../python_3_10}/CHANGELOG.md | 2 +- src/python_3_10/config.vsh.yaml | 15 ++++ .../r2u_22_04}/CHANGELOG.md | 2 +- src/r2u_22_04/config.vsh.yaml | 24 ++++++ 12 files changed, 126 insertions(+), 104 deletions(-) create mode 100644 .github/workflows/daily-build.yml delete mode 100644 .github/workflows/docker-publish.yaml create mode 100644 _viash.yaml delete mode 100644 base-python-3.10/README.md delete mode 100644 base-python-3.10/v1.0.0.Dockerfile delete mode 100644 base-r2u-22.04/README.md delete mode 100644 base-r2u-22.04/v1.0.0.Dockerfile rename {base-python-3.10 => src/python_3_10}/CHANGELOG.md (70%) create mode 100644 src/python_3_10/config.vsh.yaml rename {base-r2u-22.04 => src/r2u_22_04}/CHANGELOG.md (84%) create mode 100644 src/r2u_22_04/config.vsh.yaml diff --git a/.github/workflows/daily-build.yml b/.github/workflows/daily-build.yml new file mode 100644 index 0000000..10b42f7 --- /dev/null +++ b/.github/workflows/daily-build.yml @@ -0,0 +1,75 @@ +name: daily build + +on: + schedule: + # build daily + - cron: '0 0 * * *' + workflow_dispatch: + +jobs: + # phase 1 + list: + runs-on: ubuntu-latest + + outputs: + component_matrix: ${{ steps.set_matrix.outputs.matrix }} + cache_key: ${{ steps.cache.outputs.cache_key }} + + steps: + - uses: actions/checkout@v3 + + - uses: viash-io/viash-actions/setup@v3 + + - id: ns_list + uses: viash-io/viash-actions/ns-list@v3 + with: + platform: docker + src: src + format: json + + - id: set_matrix + run: | + echo "matrix=$(jq -c '[ .[] | + { + "name": (.functionality.namespace + "/" + .functionality.name), + "config": .info.config, + "dir": .info.config | capture("^(?.*\/)").dir + } + ]' ${{ steps.ns_list.outputs.output_file }} )" >> $GITHUB_OUTPUT + + # phase 2 + build: + needs: list + + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + component: ${{ fromJson(needs.list.outputs.component_matrix) }} + + steps: + - uses: actions/checkout@v3 + + - uses: viash-io/viash-actions/setup@v3 + + - name: Login to container registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ secrets.GTHB_USER }} + password: ${{ secrets.GTHB_PAT }} + + - name: Build container + uses: viash-io/viash-actions/ns-build@v3 + with: + platform: docker + src: ${{ matrix.component.dir }} + setup: build + + - name: Push container + uses: viash-io/viash-actions/ns-build@v3 + with: + platform: docker + src: ${{ matrix.component.dir }} + setup: push \ No newline at end of file diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml deleted file mode 100644 index d083b5c..0000000 --- a/.github/workflows/docker-publish.yaml +++ /dev/null @@ -1,46 +0,0 @@ -name: Base images for openpipelines-bio - -on: - schedule: - # build daily - - cron: '0 0 * * *' - workflow_dispatch: - - -jobs: - build: - - runs-on: ubuntu-latest - if: "!contains(github.event.head_commit.message, 'ci skip')" - - strategy: - fail-fast: false - matrix: - config: - - { image: 'base-python-3.10', version: 'v1.0.0', moretags: ',ghcr.io/openpipelines-bio/base-python-3.10:v1,ghcr.io/openpipelines-bio/base-python-3.10:latest' } - - { image: 'base-r2u-22.04', version: 'v1.0.0', moretags: ',ghcr.io/openpipelines-bio/base-r2u-22.04:v1,ghcr.io/openpipelines-bio/base-r2u-22.04:latest' } - - steps: - - uses: actions/checkout@v2 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Login to ghcr - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GTHB_PAT }} - - - name: Build and push - id: docker_build - uses: docker/build-push-action@v2 - with: - build-args: GITHUB_PAT=${{ secrets.GTHB_PAT }} - tags: ghcr.io/openpipelines-bio/${{ matrix.config.image }}:${{ matrix.config.version }}${{ matrix.config.moretags }} - file: ${{ matrix.config.image }}/${{ matrix.config.version }}.Dockerfile - push: true diff --git a/LICENSE b/LICENSE index cefc665..f5b784f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022 OpenPipelines +Copyright (c) 2021 OpenPipelines Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/_viash.yaml b/_viash.yaml new file mode 100644 index 0000000..1cd5ee6 --- /dev/null +++ b/_viash.yaml @@ -0,0 +1,9 @@ +viash_version: 0.7.3 + +source: src +target: target + +config_mods: | + .functionality.version := '1.0.0' + .platforms[.type == 'docker'].target_registry := 'ghcr.io/openpipelines-bio/base' + .platforms[.type == 'docker'].target_image_source := 'https://github.com/openpipelines-bio/base-images' diff --git a/base-python-3.10/README.md b/base-python-3.10/README.md deleted file mode 100644 index 0a6b4fe..0000000 --- a/base-python-3.10/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# Base image with Python - -Available at: [ghcr.io/openpipelines-bio/base-python-3.10](https://github.com/openpipelines-bio/base-images/pkgs/container/base-python-3.10) - -An Python 3.10 slim image with the following packages installed: - - Python 3.10 - - Python packages: - * `anndata~=0.8.0` - * `mudata~=0.2.0` - * `scanpy~=1.9.2` - - Apt packages: procps \ No newline at end of file diff --git a/base-python-3.10/v1.0.0.Dockerfile b/base-python-3.10/v1.0.0.Dockerfile deleted file mode 100644 index b1d66ac..0000000 --- a/base-python-3.10/v1.0.0.Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM python:3.10-slim - -RUN apt-get update && \ - DEBIAN_FRONTEND=noninteractive apt-get install -y procps && \ - rm -rf /var/lib/apt/lists/* - -RUN pip install --upgrade pip && \ - pip install --upgrade --no-cache-dir "anndata~=0.8.0" "mudata~=0.2.0" "scanpy~=1.9.2" - -LABEL org.opencontainers.image.description "Base image with Python" - -LABEL org.opencontainers.image.source "https://github.com/openpipelines-bio/base-images" - -LABEL org.opencontainers.image.version v1 \ No newline at end of file diff --git a/base-r2u-22.04/README.md b/base-r2u-22.04/README.md deleted file mode 100644 index 221d574..0000000 --- a/base-r2u-22.04/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# Base image with R - -Available at: [ghcr.io/openpipelines-bio/base-r2u-22.04](https://github.com/openpipelines-bio/base-images/pkgs/container/base-r2u-22.04) - -An R2U 22.04 image with the following packages installed: - - R release - - R packages: remotes, anndata and BiocManager - - Python 3.10 - - Python packages: - * `anndata~=0.8.0` - * `mudata~=0.2.0` - * `scanpy~=1.9.2` - - Apt packages: procps \ No newline at end of file diff --git a/base-r2u-22.04/v1.0.0.Dockerfile b/base-r2u-22.04/v1.0.0.Dockerfile deleted file mode 100644 index 29aaa32..0000000 --- a/base-r2u-22.04/v1.0.0.Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -FROM eddelbuettel/r2u:22.04 - -RUN Rscript -e 'if (!requireNamespace("remotes", quietly = TRUE)) install.packages("remotes")' && \ - Rscript -e 'remotes::install_cran(c("anndata", "BiocManager"), repos = "https://cran.rstudio.com")' - -RUN apt-get update && \ - DEBIAN_FRONTEND=noninteractive apt-get install -y libhdf5-dev libgeos-dev python3 python3-pip python3-dev python-is-python3 procps && \ - rm -rf /var/lib/apt/lists/* - -RUN pip install --upgrade pip && \ - pip install --upgrade --no-cache-dir "anndata~=0.8.0" "mudata~=0.2.0" "scanpy~=1.9.2" - -LABEL org.opencontainers.image.description "Base image with R and Python" - -LABEL org.opencontainers.image.source "https://github.com/openpipelines-bio/base-images" - -LABEL org.opencontainers.image.version v1 \ No newline at end of file diff --git a/base-python-3.10/CHANGELOG.md b/src/python_3_10/CHANGELOG.md similarity index 70% rename from base-python-3.10/CHANGELOG.md rename to src/python_3_10/CHANGELOG.md index fb6af0a..6218ae6 100644 --- a/base-python-3.10/CHANGELOG.md +++ b/src/python_3_10/CHANGELOG.md @@ -1,4 +1,4 @@ -# `ghcr.io/openpipelines-bio/base-python-3.10:v1.0.0` +# `ghcr.io/openpipelines-bio/base/python_3_10:1.0.0` * Initial release. An Python 3.10 image with the following packages installed: - `anndata~=0.8.0` diff --git a/src/python_3_10/config.vsh.yaml b/src/python_3_10/config.vsh.yaml new file mode 100644 index 0000000..97be580 --- /dev/null +++ b/src/python_3_10/config.vsh.yaml @@ -0,0 +1,15 @@ +functionality: + name: python_3_10 + description: A Python 3.10 slim with anndata and mudata preinstalled. +platforms: + - type: docker + image: python:3.10-slim + setup: + - type: apt + packages: + - procps + - type: python + packages: + - anndata~=0.8.0 + - mudata~=0.2.0 + - scanpy~=1.9.2 diff --git a/base-r2u-22.04/CHANGELOG.md b/src/r2u_22_04/CHANGELOG.md similarity index 84% rename from base-r2u-22.04/CHANGELOG.md rename to src/r2u_22_04/CHANGELOG.md index 1997a97..315c09c 100644 --- a/base-r2u-22.04/CHANGELOG.md +++ b/src/r2u_22_04/CHANGELOG.md @@ -1,4 +1,4 @@ -# `ghcr.io/openpipelines-bio/base-r:v1.0.0` +# `ghcr.io/openpipelines-bio/base/r2u_22_04:1.0.0` * Initial release. An R2U 22.04 image with the following packages installed: - R release diff --git a/src/r2u_22_04/config.vsh.yaml b/src/r2u_22_04/config.vsh.yaml new file mode 100644 index 0000000..9bf1346 --- /dev/null +++ b/src/r2u_22_04/config.vsh.yaml @@ -0,0 +1,24 @@ +functionality: + name: r2u_22_04 + description: An R2U 22.04 with anndata and mudata preinstalled. +platforms: + - type: docker + image: eddelbuettel/r2u:22.04 + setup: + - type: apt + packages: + - procps + - libhdf5-dev + - libgeos-dev + - python3 + - python3-pip + - python3-dev + - python-is-python3 + - type: python + packages: + - anndata~=0.8.0 + - mudata~=0.2.0 + - scanpy~=1.9.2 + - type: r + packages: + - anndata