Skip to content

Add dcmdjpeg, setup pixi #14

Add dcmdjpeg, setup pixi

Add dcmdjpeg, setup pixi #14

Workflow file for this run

name: Build
on:
push:
branches: [ main ]
tags:
- "v?[0-9]+.[0-9]+.[0-9]+*"
pull_request:
branches: [ main ]
jobs:
build:
name: Build
runs-on: ubuntu-24.04
env:
PIXI_COLOR: always
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install micromamba
uses: mamba-org/setup-micromamba@d7c9bd84e824b79d2af72a2d4196c7f4300d3476 #v3.0.0
with:
cache-downloads: true
- name: Install pixi
uses: prefix-dev/setup-pixi@a0af7a228712d6121d37aba47adf55c1332c9c2e # v0.9.4
with:
pixi-version: v0.67.2
run-install: false
- name: Set version
if: startsWith(github.ref, 'refs/tags/v')
run: |
ref_name='${{ github.ref_name }}'
version_number="${ref_name:1}"
pixi project version set "$version_number"
- name: Docker meta
id: meta
uses: docker/metadata-action@v6
with:
images: |
docker.io/fnndsc/pl-dcm2niix
ghcr.io/fnndsc/pl-dcm2niix
tags: |
type=pep440,pattern={{version}}
type=pep440,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}
# pixi and micromamba don't have ppc64le images available, so to build
# images for ppc64le, we create conda environments using micromamba
# which are then copied into the container images. This also happens
# to be more efficient than running a package manager during docker
# build using QEMU.
# See also: https://github.com/Quantco/pixi-pack/issues/84
- name: Export conda-explicit-spec
run: pixi project export conda-explicit-spec --frozen --ignore-pypi-errors conda-specs
- name: Create env for linux/amd64
run: micromamba create --platform linux-64 --relocate-prefix /opt/conda-env -f conda-specs/prod_linux-64_conda_spec.txt -p ./envs/linux/amd64
- name: Create env for linux/arm64
run: micromamba create --platform linux-aarch64 --relocate-prefix /opt/conda-env -f conda-specs/prod_linux-aarch64_conda_spec.txt -p ./envs/linux/arm64
- name: Create env for linux/ppc64le
run: micromamba create --platform linux-ppc64le --relocate-prefix /opt/conda-env -f conda-specs/prod_linux-ppc64le_conda_spec.txt -p ./envs/linux/ppc64le
- name: Build wheel
run: pixi run -e build build
- uses: docker/setup-qemu-action@v4
- uses: docker/setup-buildx-action@v4
- name: Login to DockerHub
id: login-dockerhub
if: github.event_name == 'push'
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to GitHub Container Registry
id: login-ghcr
if: github.event_name == 'push'
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v7
with:
push: ${{ steps.login-dockerhub.outcome == 'success' && steps.login-ghcr.outcome == 'success' }}
context: .
file: ./prod.Dockerfile
platforms: linux/amd64,linux/arm64,linux/ppc64le
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Upload ChRIS Plugin
id: upload
if: github.ref_type == 'tag'
uses: FNNDSC/upload-chris-plugin@v1
with:
dock_image: ${{ steps.info.outputs.local_tag }}
username: ${{ secrets.CHRISPROJECT_USERNAME }}
password: ${{ secrets.CHRISPROJECT_PASSWORD }}
chris_url: https://cube.chrisproject.org/api/v1/
compute_names: NERC
- name: Update DockerHub description
if: steps.upload.outcome == 'success'
uses: peter-evans/dockerhub-description@1b9a80c056b620d92cedb9d9b5a223409c68ddfa #v5.0.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
short-description: ${{ steps.upload.outputs.title }}
readme-filepath: ./README.md