Skip to content

Dockerfile: Use CI image 'main' as base image #27

Dockerfile: Use CI image 'main' as base image

Dockerfile: Use CI image 'main' as base image #27

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
tags: [ 'v*' ]
pull_request:
branches: [ main ]
permissions:
packages: write
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build (${{ matrix.variant.platform }})
runs-on:
group: ${{ matrix.variant.builder }}
container:
image: ghcr.io/zephyrproject-rtos/image-build:v1.0.0
strategy:
fail-fast: true
matrix:
variant:
- platform: linux/amd64
arch: amd64
builder: zephyr-runner-v2-linux-x64-4xlarge
- platform: linux/arm64
arch: arm64
builder: zephyr-runner-v2-linux-arm64-4xlarge
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Generate metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/zephyrproject-rtos/ci-repo-cache
flavor: |
latest=false
suffix=-${{ matrix.variant.arch }}
tags: |
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
- name: Login to GitHub Container Registry
if: ${{ github.event_name != 'pull_request' }}
uses: redhat-actions/podman-login@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image
uses: redhat-actions/buildah-build@v2
with:
context: .
containerfiles: Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Push image
if: ${{ github.event_name != 'pull_request' }}
uses: redhat-actions/push-to-registry@v2
with:
tags: ${{ steps.meta.outputs.tags }}
merge:
name: Merge
runs-on:
group: zephyr-runner-v2-linux-x64-4xlarge
container:
image: ghcr.io/zephyrproject-rtos/image-build:v1.0.0
needs: build
if: ${{ github.event_name != 'pull_request' }}
steps:
- name: Login to GitHub Container Registry
uses: redhat-actions/podman-login@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/zephyrproject-rtos/ci-repo-cache
flavor: |
latest=false
tags: |
type=ref,event=branch
type=ref,event=tag
type=raw,value=latest,enable={{is_default_branch}}
- name: Create multi-architecture image
run: |
archs=(amd64 arm64)
image="ghcr.io/zephyrproject-rtos/ci-repo-cache:${{ steps.meta.outputs.version }}"
image_tags="${{ steps.meta.outputs.tags }}"
# Pull architecture-specific image.
for arch in ${archs[@]}; do
podman pull ${image}-${arch}
done
# Create multi-architecture image.
for arch in ${archs[@]}; do
image_amend_flags+="--amend ${image}-${arch} "
done
podman manifest create ${image} ${image_amend_flags}
# Create image tags.
for tag in ${image_tags}; do
podman tag ${image} ${tag}
done
- name: Push image
uses: redhat-actions/push-to-registry@v2
with:
tags: ${{ steps.meta.outputs.tags }}