Skip to content

Use docker build and push action #19

Use docker build and push action

Use docker build and push action #19

Workflow file for this run

name: RHEL
on:
push:
paths:
- .github/workflows/rhel.yml
- docker/rhel/Dockerfile
env:
CONTAINER_REGISTRY: ghcr.io
REDHAT_REGISTRY: registry.redhat.io
DOCKER_BUILDKIT: 1
BUILDKIT_PROGRESS: plain
CONAN_VERSION: 2.17.0
NONROOT_USER: ci
jobs:
# Build the Docker image for Red Hat Enterprise Linux using different versions
# of GCC.
gcc:
runs-on: ubuntu-latest
strategy:
matrix:
version:
- os: 9.6
gcc: 13
- os: 9.6
gcc: 14
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Registry
uses: docker/login-action@v3
with:
registry: ${{ env.CONTAINER_REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Red Hat Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REDHAT_REGISTRY }}
username: ${{ secrets.REDHAT_USER }}
password: ${{ secrets.REDHAT_TOKEN }}
- name: Determine the Docker image name.
run: |
# Convert the repository name to lowercase as the organization name is
# uppercase, which is not permitted by the Docker registry.
GITHUB_REPO=${{ github.repository }}
CONTAINER_REPOSITORY=${GITHUB_REPO@L}
echo "CONTAINER_IMAGE=${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}/rhel-${{ matrix.version.os }}:gcc${{ matrix.version.gcc }}" >> $GITHUB_ENV
- name: Build and push the Docker image
uses: docker/build-push-action@v6
with:
build-args: |
BUILDKIT_DOCKERFILE_CHECK=skip=InvalidDefaultArgInFrom
BUILDKIT_INLINE_CACHE=1
CONAN_VERSION=${{ env.CONAN_VERSION }}
GCC_VERSION=${{ matrix.version.gcc }}
GITHUB_REPO=${{ github.repository }}
NONROOT_USER=${{ env.NONROOT_USER }}
RHEL_VERSION=${{ matrix.version.os }}
context: docker/rhel
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.CONTAINER_IMAGE }}
target: gcc
# Build the Docker image for Red Hat Enterprise Linux using Clang. As we use
# the free UBIs we cannot select specific versions of Clang and only get what
# is available in the base image.
clang:
runs-on: ubuntu-latest
strategy:
matrix:
version:
- os: 9.6
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Registry
uses: docker/login-action@v3
with:
registry: ${{ env.CONTAINER_REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Red Hat Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REDHAT_REGISTRY }}
username: ${{ secrets.REDHAT_USER }}
password: ${{ secrets.REDHAT_TOKEN }}
- name: Determine the Docker image name.
run: |
# Convert the repository name to lowercase as the organization name is
# uppercase, which is not permitted by the Docker registry.
GITHUB_REPO=${{ github.repository }}
CONTAINER_REPOSITORY=${GITHUB_REPO@L}
echo "CONTAINER_IMAGE=${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}/rhel-${{ matrix.version.os }}:clang" >> $GITHUB_ENV
- name: Build and push the Docker image
uses: docker/build-push-action@v6
with:
build-args: |
BUILDKIT_DOCKERFILE_CHECK=skip=InvalidDefaultArgInFrom
BUILDKIT_INLINE_CACHE=1
CONAN_VERSION=${{ env.CONAN_VERSION }}
GITHUB_REPO=${{ github.repository }}
NONROOT_USER=${{ env.NONROOT_USER }}
RHEL_VERSION=${{ matrix.version.os }}
context: docker/rhel
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.CONTAINER_IMAGE }}
target: clang