Skip to content

Commit

Permalink
chore: publish docker image on release (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
ovesh committed Nov 15, 2024
1 parent 1245558 commit 3ed57fc
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 5 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/dockerize.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: dockerize
run-name: dockerize
on:
push:
# only build+push docker on release-please tags
tags: ["v*"]
paths:
- ".github/actions/**"
- ".github/workflows/**"
- "conda-recipe/**"
- "genome_kit/**"
- "setup.py"
- "setup/**"
- "src/**"
- "tests/**"

jobs:
docker-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: ./.github/actions/build-gk
with:
platform: linux-64

- name: restore mamba env
id: restore_mamba_cache
uses: actions/cache/restore@v4
with:
key: mamba-env-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/workflows/run-tests.yaml', '.github/actions/**') }}
path: |
~/micromamba
~/.condarc
~/bin/micromamba
fail-on-cache-miss: true

- name: restore the gk package tarballs
id: restore_gk_pkg
uses: actions/cache/restore@v4
with:
key: mamba-env-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/workflows/run-tests.yaml', '.github/actions/**', 'conda-recipe/meta.yaml', 'src/**', 'genome_kit/**', 'tests/**') }}
path: |
~/conda-bld
fail-on-cache-miss: true

- name: create gk env
id: create-gk-env
shell: bash -l -e {0}
run: |
set -x
# explicitly select py310
pgk_file_path=$(eval ls -1 ~/conda-bld/linux-64/*py310*.tar.bz2 | head -1)
pkg_file=$(basename ${pgk_file_path})
pkg_version=$(echo $pkg_file | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+')
echo "PKG_VERSION=${pkg_version}" >> $GITHUB_OUTPUT
micromamba activate build
conda index ~/conda-bld
mamba create -n genomekit -c file://${HOME}/conda-bld genomekit=${pkg_version}
set +x
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v6
with:
context: /home/runner/micromamba/envs/build/envs
file: Dockerfile
push: true
tags: |
deepgenomicsinc/genomekit:latest
deepgenomicsinc/genomekit:latest-py310
deepgenomicsinc/genomekit:${{ steps.create-gk-env.outputs.PKG_VERSION }}-py310
9 changes: 4 additions & 5 deletions .github/workflows/publish-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,13 @@ jobs:
shell: bash -l -e {0}
run: |
set -x
pkg_name=$(eval ls -1 ~/conda-bld/*/*.tar.bz2 | head -1)
pkg_name=$(basename ${pkg_name})
pkg_version=$(echo $pkg_name | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+')
pkg_name=${pkg_name%%-[0-9]*}
pgk_file_path=$(eval ls -1 ~/conda-bld/*/*.tar.bz2 | head -1)
pkg_file=$(basename ${pgk_file_path})
pkg_version=$(echo $pkg_file | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+')
micromamba activate build
conda index ~/conda-bld
mamba create -n doc-build -c file://${HOME}/conda-bld \
${pkg_name}=${pkg_version} \
genomekit=${pkg_version} \
m2r2 \
make \
myst-parser \
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM ubuntu:22.04
COPY genomekit /opt/conda/envs/
ENV PATH=/opt/conda/envs/genomekit/bin:$PATH
8 changes: 8 additions & 0 deletions docs-src/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ You can install GenomeKit with::
conda install -c conda-forge genomekit


Use with docker
~~~~~~~~~~~~~~~~~

Alternatively you can use GenomeKit with docker::

$ docker run -it --rm deepgenomicsinc/genomekit:latest python
>>> import genome_kit

Basics
------

Expand Down

0 comments on commit 3ed57fc

Please sign in to comment.