Skip to content

Update Dockerfile

Update Dockerfile #476

Workflow file for this run

name: Build images
on:
pull_request:
types: [opened, reopened]
push:
branches:
- '**'
tags:
- 'v*'
schedule:
- cron: '0 3 * * 1'
jobs:
build:
runs-on: ubuntu-latest
continue-on-error: true
permissions:
packages: write
strategy:
matrix:
context:
- centos7-lcg100-gcc10
- centos7-lcg101-gcc11
- centos8-lcg100-gcc10
- centos8-lcg101-gcc11
- format10
- format14
- ubuntu1804_cuda
- ubuntu1804_cuda_oneapi
- ubuntu1804_rocm
- ubuntu1804_rocm_oneapi
- ubuntu2004
- ubuntu2004_cuda
- ubuntu2004_cuda_oneapi
- ubuntu2004_rocm
- ubuntu2004_rocm_oneapi
- ubuntu2004_oneapi
- ubuntu2004_exatrkx
- ubuntu2204
- ubuntu2204_clang
- ubuntu2204_cpp20
- centos7-base
- centos8-base
- alma9-base
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare
id: prep
run: |
DOCKER_IMAGE=ghcr.io/${{ github.repository_owner }}/${{ matrix.context }}
VERSION=edge
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
elif [[ $GITHUB_REF == refs/heads/* ]]; then
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
elif [[ $GITHUB_REF == refs/pull/* ]]; then
VERSION=pr-${{ github.event.number }}
fi
TAGS="${DOCKER_IMAGE}:${VERSION}"
if [ "${{ github.event_name }}" = "push" ]; then
TAGS="$TAGS,${DOCKER_IMAGE}:sha-${GITHUB_SHA::8}"
fi
echo ::set-output name=version::${VERSION}
echo ::set-output name=tags::${TAGS}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
- uses: docker/build-push-action@v3
with:
push: true
context: ${{ matrix.context }}
tags: ${{ steps.prep.outputs.tags }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/${{ matrix.context }}:buildcache
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/${{ matrix.context }}:buildcache,mode=max