From 8b6743a3c538a2296640a1cb2422e420f4865f21 Mon Sep 17 00:00:00 2001 From: SophieS9 Date: Wed, 10 Dec 2025 13:25:46 +0000 Subject: [PATCH 1/3] Containerise the repo --- .github/workflows/build_container.yml | 61 +++++++++++++++++++++++++++ Containerfile | 10 +++++ 2 files changed, 71 insertions(+) create mode 100644 .github/workflows/build_container.yml create mode 100644 Containerfile diff --git a/.github/workflows/build_container.yml b/.github/workflows/build_container.yml new file mode 100644 index 0000000..a823f38 --- /dev/null +++ b/.github/workflows/build_container.yml @@ -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 }} diff --git a/Containerfile b/Containerfile new file mode 100644 index 0000000..f13ec69 --- /dev/null +++ b/Containerfile @@ -0,0 +1,10 @@ +FROM docker.io/python:3.11 + +# Copy script into folder +COPY CoverageCalculatorPy.py ./ + +RUN chmod +x CoverageCalculatorPy.py + +# Install pytabix +RUN pip install pytabix==0.1 + From d5b9830d602dac4a2ef7a4ae627c5e0e17516cdf Mon Sep 17 00:00:00 2001 From: SophieS9 Date: Fri, 12 Dec 2025 13:12:06 +0000 Subject: [PATCH 2/3] Put scripts in a nicer place --- Containerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Containerfile b/Containerfile index f13ec69..783e31f 100644 --- a/Containerfile +++ b/Containerfile @@ -1,9 +1,9 @@ FROM docker.io/python:3.11 # Copy script into folder -COPY CoverageCalculatorPy.py ./ +COPY CoverageCalculatorPy.py /usr/bin/ -RUN chmod +x CoverageCalculatorPy.py +RUN chmod +x /usr/bin/CoverageCalculatorPy.py # Install pytabix RUN pip install pytabix==0.1 From 145cd8a465af06b1e90039c39bf86f78bd1a65f6 Mon Sep 17 00:00:00 2001 From: SophieS9 Date: Wed, 31 Dec 2025 13:09:22 +0000 Subject: [PATCH 3/3] Add singularity container --- env/CoverageCalculatorPy.def | 15 +++++++++++++++ env/CoverageCalculatorPy.yml | 6 ++---- 2 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 env/CoverageCalculatorPy.def diff --git a/env/CoverageCalculatorPy.def b/env/CoverageCalculatorPy.def new file mode 100644 index 0000000..d742da7 --- /dev/null +++ b/env/CoverageCalculatorPy.def @@ -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 "$@" diff --git a/env/CoverageCalculatorPy.yml b/env/CoverageCalculatorPy.yml index adc30e8..b3139eb 100644 --- a/env/CoverageCalculatorPy.yml +++ b/env/CoverageCalculatorPy.yml @@ -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