Skip to content

feat: Unify containers #16

feat: Unify containers

feat: Unify containers #16

Workflow file for this run

name: Build images
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
paths-ignore:
- '.circleci/**'
- 'docs/**'
- 'test/**'
env:
BIOCONDA_UTILS_FOLDER: bioconda-utils
DEBIAN_VERSION: "12.2"
BUSYBOX_VERSION: "1.36.1"
BASE_TAGS: "0.1.1 latest"
BUILD_ENV_IMAGE_NAME: tmp-build-env
CREATE_ENV_IMAGE_NAME: tmp-create-env
BASE_DEBIAN_IMAGE_NAME: tmp-debian
BASE_BUSYBOX_IMAGE_NAME: tmp-busybox
ARCHS: "amd64 arm64"
ERROR_IF_MISSING: "false" # Used for testing when the repository is known to be missing on quay.io
jobs:
# NOTE: base-debian can be a separate job since it is independent of the
# others. create-env depends on build-env, and both depend on base-busybox,
# so we can't split that out.
build-debian:
name: Build base-debian
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install qemu dependency
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
- name: Build base-debian
run: |
IMAGE_NAME=$BASE_DEBIAN_IMAGE_NAME \
IMAGE_DIR=images/base-glibc-debian-bash \
TYPE="base-debian" \
DEBIAN_VERSION=$DEBIAN_VERSION \
ARCHS=$ARCHS \
TAGS=$BASE_TAGS \
./generic_build.bash
- name: Push base-debian
id: push-base-debian
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ env.BASE_DEBIAN_IMAGE_NAME }}
tags: ${{ env.BASE_TAGS }}
registry: ${{ secrets.QUAY_BIOCONDA_REPO }}
username: ${{ secrets.QUAY_BIOCONDA_USERNAME }}
password: ${{ secrets.QUAY_BIOCONDA_TOKEN }}
build-others:
if: false # disable for now
name: Build base-busybox, build-env, and create-env images
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: get-tag
run: |
tag=${{ github.event.release && github.event.release.tag_name || github.sha }}
printf %s "tag=${tag#v}" >> $GITHUB_OUTPUT
- name: Install qemu dependency
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
- name: Build base-busybox
run: |
IMAGE_NAME=$BASE_BUSYBOX_IMAGE_NAME \
IMAGE_DIR=images/base-glibc-busybox-bash \
TYPE="base-busybox" \
ARCHS=$ARCHS \
DEBIAN_VERSION=$DEBIAN_VERSION \
BUSYBOX_VERSION=$BUSYBOX_VERSION \
TAGS=$BASE_TAGS \
./generic_build.bash
- name: Build build-env
run: |
# The Dockerfile expects bioconda-utils to be cloned; even though we're
# working in the bioconda-utils repo the code needs to be in the build
# context, which is in the respective image dir.
if [ ! -e "images/bioconda-utils-build-env-cos7/bioconda-utils" ]; then
git clone https://github.com/bioconda/bioconda-utils images/bioconda-utils-build-env-cos7/bioconda-utils
else
(cd images/bioconda-utils-build-env-cos7/bioconda-utils && git fetch)
fi
# This expects the busybox image to have been built locally.
IMAGE_NAME=$BUILD_ENV_IMAGE_NAME \
IMAGE_DIR=images/bioconda-utils-build-env-cos7 \
ARCHS=$ARCHS \
TYPE="build-env" \
BIOCONDA_UTILS_VERSION='${{ github.head_ref || github.ref_name }}' \
BUSYBOX_IMAGE=localhost/$BASE_BUSYBOX_IMAGE_NAME \
./generic_build.bash
- name: Build create-env
run: |
BIOCONDA_UTILS_VERSION='${{ github.head_ref || github.ref_name }}' \
# Here we extract the conda and mamba versions from the just-created
# build-env container. This ensures that when creating environments, we
# use the exact same conda/mamba versions used when building the
# package.
CONDA_VERSION=$(
podman run -t localhost/${BUILD_ENV_IMAGE_NAME}:${BIOCONDA_UTILS_VERSION} \
bash -c "/opt/conda/bin/conda list --export '^conda$'| sed -n 's/=[^=]*$//p'"
)
MAMBA_VERSION=$(
podman run -t localhost/${BUILD_ENV_IMAGE_NAME}:${BIOCONDA_UTILS_VERSION} \
bash -c "/opt/conda/bin/conda list --export '^mamba$'| sed -n 's/=[^=]*$//p'"
)
# Remove trailing \r with parameter expansion
export CONDA_VERSION=${CONDA_VERSION%$'\r'}
export MAMBA_VERSION=${MAMBA_VERSION%$'\r'}
IMAGE_NAME=$CREATE_ENV_IMAGE_NAME \
IMAGE_DIR=images/create-env \
ARCHS=$ARCHS \
TYPE="create-env" \
BUSYBOX_IMAGE=localhost/$BASE_BUSYBOX_IMAGE_NAME \
BIOCONDA_UTILS_VERSION=$BIOCONDA_UTILS_VERSION \
./generic_build.bash