Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
61 changes: 61 additions & 0 deletions .github/workflows/build_container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Build Image using Containerfile
on:
push:
branches:
- 'development'
tags:

pull_request:
types:
- opened
- synchronize
branches:
- 'development'

permissions:
packages: write
contents: read

jobs:
build:
name: Build image
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Determine tags
shell: bash
env:
REF_TYPE: ${{ github.ref_type }}
SHA: ${{ github.sha }}
EVENT_NAME: ${{ github.event_name }}
run: |
if [[ "${EVENT_NAME}" == "pull_request" ]]; then
echo "BASE_TAGS=${SHA}" | tee -a "${GITHUB_ENV}"
elif [[ "${REF_TYPE}" == "tag" ]]; then
echo "BASE_TAGS=latest ${GITHUB_REF#refs/*/} ${SHA}" | tee -a "${GITHUB_ENV}"
elif [[ "${REF_TYPE}" == "branch" ]]; then
echo "BASE_TAGS=${GITHUB_REF#refs/*/} ${SHA}" | tee -a "${GITHUB_ENV}"
else
echo "BASE_TAGS=${SHA}" | tee -a "${GITHUB_ENV}"
fi

- name: Buildah Action
id: build_image
uses: redhat-actions/buildah-build@v2
with:
image: CoverageCalculatorPy
tags: ${{ env.BASE_TAGS }}
containerfiles: |
./Containerfile

- name: Push to GHCR
uses: redhat-actions/push-to-registry@v2
if: github.event_name != 'pull_request'
with:
image: ${{ steps.build_image.outputs.image }}
tags: ${{ steps.build_image.outputs.tags }}
registry: ghcr.io/awgl
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
10 changes: 10 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM docker.io/python:3.11

# Copy script into folder
COPY CoverageCalculatorPy.py /usr/bin/

RUN chmod +x /usr/bin/CoverageCalculatorPy.py

# Install pytabix
RUN pip install pytabix==0.1

15 changes: 15 additions & 0 deletions env/CoverageCalculatorPy.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Bootstrap: docker
From: python:3.11

%files
../CoverageCalculatorPy.py /usr/bin/CoverageCalculatorPy.py

%post
# Make script executable
chmod +x /usr/bin/CoverageCalculatorPy.py

# Install pytabix
pip install pytabix==0.1

%runscript
exec "$@"
6 changes: 2 additions & 4 deletions env/CoverageCalculatorPy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ channels:
- bioconda
- defaults
dependencies:
- python=3.6.7
- zlib=1.2.11
- pip:
- pytabix==0.1
- python=3.11
- pytabix=0.1

Loading