Update README.md #109
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
name: CI | |
on: | |
push: | |
branches: | |
- master | |
repository_dispatch: | |
types: | |
- release | |
env: | |
orgname: intersystemsdc | |
name: | | |
iris-community | |
irishealth-community | |
iris-ml-community | |
irishealth-ml-community | |
latest: 2023.3 | |
version: | | |
2023.2 | |
2023.1.1.380.0 | |
preview: latest-preview | |
jobs: | |
version: | |
runs-on: ubuntu-latest | |
outputs: | |
name: ${{ steps.set-matrix.outputs.name }} | |
version: ${{ steps.set-matrix.outputs.version }} | |
steps: | |
- id: set-matrix | |
run: | | |
echo name=`jq -Rsc 'split("\n") | map(select(length > 0))' <<< $'${{ env.name }}' ` >> $GITHUB_OUTPUT | |
echo version=`jq -Rsc 'split("\n") | map(select(length > 0))' <<< $'${{ env.latest }}\n${{ env.version }}\n${{ env.preview }}' ` >> $GITHUB_OUTPUT | |
build: | |
needs: | |
- version | |
strategy: | |
fail-fast: false | |
matrix: | |
name: ${{ fromJSON(needs.version.outputs.name ) }} | |
version: ${{ fromJSON(needs.version.outputs.version ) }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: set variables | |
id: vars | |
run: | | |
echo "base=containers.intersystems.com/intersystems/${{ matrix.name }}:${{ matrix.version }}" >> $GITHUB_OUTPUT | |
echo "basearm=containers.intersystems.com/intersystems/${{ matrix.name }}-arm64:${{ matrix.version }}" >> $GITHUB_OUTPUT | |
image=${{ env.orgname }}/${{ matrix.name }} | |
[ '${{ secrets.DOCKER_ORGNAME }}' != '' ] && image=${{ secrets.DOCKER_ORGNAME }}/${{ matrix.name }} | |
version=${{ matrix.version }}-zpm | |
echo "image=$image" >> $GITHUB_OUTPUT | |
echo "version=$version" >> $GITHUB_OUTPUT | |
tags=" -t $image:$version" | |
[ '${{ matrix.version }}' == '${{ env.latest }}' ] && tags+=" -t $image:latest" | |
[ '${{ matrix.version }}' == '${{ env.preview }}' ] && tags+=" -t $image:preview" | |
echo "tags=$tags" >> $GITHUB_OUTPUT | |
tagsarm=" -t $image-arm64:$version" | |
[ '${{ matrix.version }}' == '${{ env.latest }}' ] && tagsarm+=" -t $image-arm64:latest" | |
[ '${{ matrix.version }}' == '${{ env.preview }}' ] && tagsarm+=" -t $image-arm64:preview" | |
echo "tagsarm=$tagsarm" >> $GITHUB_OUTPUT | |
- uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
- name: pull docker image | |
uses: nick-invision/retry@v2 | |
with: | |
timeout_minutes: 30 | |
max_attempts: 3 | |
retry_on: timeout | |
command: | | |
docker pull ${{ steps.vars.outputs.base }} | |
- name: pull arm64 docker image | |
id: pullarm | |
continue-on-error: true | |
uses: nick-invision/retry@v2 | |
with: | |
timeout_minutes: 30 | |
max_attempts: 3 | |
retry_on: timeout | |
command: | | |
docker pull ${{ steps.vars.outputs.basearm }} | |
- name: docker login | |
id: login | |
continue-on-error: true | |
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
- name: build x86 docker image | |
id: build | |
uses: nick-invision/retry@v2 | |
with: | |
timeout_minutes: 10 | |
max_attempts: 3 | |
retry_on: any | |
command: | | |
docker build --progress plain --no-cache --file Dockerfile-amd64 --build-arg IMAGE=${{ steps.vars.outputs.base }} --build-arg IMAGEARM=${{ steps.vars.outputs.basearm }} ${{ steps.vars.outputs.tags }} --platform linux/amd64 . | |
- name: push to docker hub | |
id: push | |
if: steps.login.outcome == 'success' | |
run: | | |
tags="${{ steps.vars.outputs.tags }}";tags=${tags// -t / } | |
echo $tags | xargs -n1 sh -c 'docker push $0' | |
- name: build arm64 docker image | |
id: buildarm | |
if: steps.pullarm.outcome == 'success' | |
uses: nick-invision/retry@v2 | |
with: | |
timeout_minutes: 10 | |
max_attempts: 3 | |
retry_on: any | |
command: | | |
docker system prune -f | |
docker build --progress plain --no-cache --file Dockerfile-arm64 --build-arg IMAGE=${{ steps.vars.outputs.base }} --build-arg IMAGEARM=${{ steps.vars.outputs.basearm }} ${{ steps.vars.outputs.tagsarm }} --platform linux/arm64 . | |
- name: push arm64 to docker hub | |
id: pusharm | |
if: steps.buildarm.outcome == 'success' | |
run: | | |
tags="${{ steps.vars.outputs.tagsarm }}";tags=${tags// -t / } | |
echo $tags | xargs -n1 sh -c 'docker push $0' | |
- name: update manifest | |
if: steps.push.outcome == 'success' && steps.pusharm.outcome == 'success' | |
uses: nick-invision/retry@v2 | |
with: | |
timeout_minutes: 10 | |
max_attempts: 3 | |
retry_on: timeout | |
command: | | |
tags="${{ steps.vars.outputs.tagsarm }}";tags=${tags// -t / } | |
echo $tags | xargs -n1 bash -c 'docker manifest rm ${1//-arm64/} || true' - $1 | |
echo $tags | xargs -n1 bash -c 'docker manifest inspect ${1//-arm64/}' - $1 | |
echo $tags | xargs -n1 bash -c 'docker manifest create ${1//-arm64/} ${1//-arm64/} $1 --amend' - $1 | |
echo $tags | xargs -n1 bash -c 'docker manifest push ${1//-arm64/}' - $1 | |
echo $tags | xargs -n1 bash -c 'docker manifest inspect ${1//-arm64/}' - $1 |