-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
94 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: 'Build Docker images' | ||
description: 'Build Docker images' | ||
|
||
inputs: | ||
snapatac2-version: | ||
description: 'SnapATAC2 version to be installed' | ||
required: true | ||
type: string | ||
|
||
python-version: | ||
required: false | ||
default: "python:3.11-slim" | ||
|
||
flavor: | ||
required: false | ||
default: "default" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
# This makes some assumptions about `base-docker-image` name format so be sure to test this out if | ||
# things change. For `python:3.11-slim` this should result in `PY_VER_ABBRV=py3.11` beings saved to $GITHUB_ENV | ||
# See: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable | ||
- name: Get python version shorthand | ||
run: echo "PY_VER_ABBRV=py$(echo ${{ matrix.base-docker-image }} | cut -d ":" -f 2 | cut -d "-" -f 1)" >> $GITHUB_ENV | ||
# Should result in something like: `IMAGE_TAG=2.5.1-default-py3.11` or `IMAGE_TAG=2.5.1-recommend-interactive-py3.11` | ||
- name: Create Docker image tag | ||
run: echo "IMAGE_TAG=${{ inputs.snapatac2-version }}-${{ inputs.flavor }}-${{ inputs.python-version }}" >> $GITHUB_ENV | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
lfs: true | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
# TODO: Has SnapATAC2 been tested for arm64? If it has and it works then uncomment the following | ||
# section and also add `linux/arm64` to `platforms` in subsequent steps: | ||
# # https://github.com/docker/setup-qemu-action | ||
# - name: Set up QEMU | ||
# uses: docker/setup-qemu-action@v3 | ||
# https://github.com/docker/build-push-action | ||
# Uses github actions cache: https://docs.docker.com/build/cache/backends/gha/ | ||
- name: Build Dockerfile | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: docker/${{ inputs.flavor }} | ||
platforms: linux/amd64 | ||
build-args: | | ||
BASE_PYTHON_IMAGE=python:${{ inputs.python-version }}-slim | ||
SNAP_ATAC_VERSION=${{ inputs.snapatac2-version }} | ||
load: true | ||
tags: snapatac2:TEST-${{ env.IMAGE_TAG }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
# Mount the Github Workspace (repository root) into our test container | ||
# Then install test required packages and run SnapATAC2 Python tests | ||
- name: Test Docker Image | ||
run: | | ||
docker run --rm -t \ | ||
--entrypoint /bin/bash \ | ||
--volume "${{ github.workspace }}":"/github/workspace" \ | ||
snapatac2:TEST-${{ env.IMAGE_TAG }} \ | ||
-c "python3 -m pip install pytest hypothesis && pytest /github/workspace/snapatac2-python/tests" | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.dockerhub_username }} | ||
password: ${{ secrets.dockerhub_token }} | ||
|
||
# Uses cached result from first build | ||
- name: Push to Docker Hub | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: docker/${{ inputs.flavor }} | ||
platforms: linux/amd64 | ||
build-args: | | ||
BASE_PYTHON_IMAGE=python:${{ inputs.python-version }}-slim | ||
SNAP_ATAC_VERSION=${{ inputs.snapatac2-version }} | ||
push: true | ||
tags: snapatac2:${{ env.IMAGE_TAG }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters