Skip to content

[build] fix recursive dependency in tag build #203

[build] fix recursive dependency in tag build

[build] fix recursive dependency in tag build #203

Workflow file for this run

name: Create and publish Docker images
on:
push: { branches: [ unstable, '[0-9]+.[0-9]+.x' ] }
pull_request:
branches: [ unstable, '[0-9]+.[0-9]+.x' ]
paths: ['Docker/**']
workflow_call:
workflow_dispatch:
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
include:
- name: github_ci
- name: openmpi
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}_${{ matrix.name }}
- name: Build and cache base Docker image
uses: docker/build-push-action@v5
with:
context: ./Docker
file: ./Docker/${{ matrix.name }}_dockerfile
build-args: |
NCORES=2
target: base
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=${{ github.ref_name }}-${{ matrix.name }}
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-${{ matrix.name }}
- name: Build and push final Docker image
uses: docker/build-push-action@v5
with:
context: ./Docker
file: ./Docker/${{ matrix.name }}_dockerfile
build-args: |
NCORES=2
# cache pkgs layer in dockerfile
no-cache-filters: pkgs
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}